Re: [PATCH v6 3/3] gpio: TS-5500 GPIO support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2012-05-17 at 15:06 -0600, Grant Likely wrote:
> On Thu, 12 Apr 2012 20:28:55 -0400, Vivien Didelot <vivien.didelot@xxxxxxxxxxxxxxxxxxxx> wrote:
> > From: Jerome Oufella <jerome.oufella@xxxxxxxxxxxxxxxxxxxx>
[]
> > +/* "DIO" line to IO port mapping table for line's value */
> > +static const unsigned long line_to_port_map[] = {
> > +	0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B,	/* DIO1_[0-7] */
> > +	0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C,		/* DIO1_[8-13] */
> > +	0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E,	/* DIO2_[0-7] */
> > +	0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,		/* DIO2_[8-13] */
> > +	0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72,	/* LCD_[0-7] */
> > +	0x73, 0x73, 0x73				/* LCD_{EN,RS,WR} */
> > +};

There doesn't seem to be a reason to make this a ulong.
uchar would suffice.

> > +
> > +/* "DIO" line to IO port's bit map for line's value */
> > +static const int line_to_bit_map[] = {
> > +	0, 1, 2, 3, 4, 5, 6, 7,	/* DIO1_[0-7] */
> > +	0, 1, 2, 3, 4, 5,	/* DIO1_[8-13] */
> > +	0, 1, 2, 3, 4, 5, 6, 7,	/* DIO2_[0-7] */
> > +	0, 1, 2, 3, 4, 5,	/* DIO2_[8-13] */
> > +	0, 1, 2, 3, 4, 5, 6, 7,	/* LCD_[0-7] */
> > +	0, 7, 6			/* LCD_{EN,RS,WR} */

Nor this an int, s8 maybe.

> > +/* "DIO" line's direction control mapping table */
> > +static const unsigned long line_to_dir_map[] = {
> > +	0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A,	/* DIO1_[0-7] */
> > +	0x7A, 0x7A, 0x7A, 0x7A, 0, 0,			/* DIO1_[8-13] */
> > +	0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D,	/* DIO2_[0-7] */
> > +	0x7D, 0x7D, 0x7D, 0x7D, 0, 0,			/* DIO2_[8-13] */
> > +	0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D,	/* LCD_[0-7] */
> > +	0, 0, 0						/* LCD_{EN,RS,WR} */

uchar

> > +/* "DIO" line's direction control bit-mapping table */
> > +static const int line_to_dir_bit_map[] = {
> > +	0, 0, 0, 0, 1, 1, 1, 1,	/* DIO1_[0-7] */
> > +	5, 5, 5, 5, -1, -1,	/* DIO1_[8-13] */
> > +	0, 0, 0, 0, 1, 1, 1, 1,	/* DIO2_[0-7] */
> > +	5, 5, 5, 5, -1, -1,	/* DIO2_[8-13] */
> > +	2, 2, 2, 2, 3, 3, 3, 3,	/* LCD_[0-7] */
> > +	-1, -1, -1		/* LCD_{EN,RS,WR} */
> > +};

s8?

> Splitting up this data into 4 arrays seems odd.  I think it would be
> better to define a single table with a tuple for each line.

yup.



_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux