lkml.org 
[lkml]   [2021]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 1/7] gpio: gpio-ep93xx: fix BUG_ON port F usage
From
Date
Hello Nikita,

On Thu, 2021-01-28 at 18:11 +0200, Andy Shevchenko wrote:
> > +/*
> > + * F Port index in GPIOCHIP'S array is 5
> > + * but we use index 2 for stored values and offsets
> > + */
> > +#define EP93XX_GPIO_F_PORT_INDEX 5
>
> Hmm... Why not to use an array with holes instead.
>
> ...
>
> > +       if (port == EP93XX_GPIO_F_PORT_INDEX)
> > +               port = 2;
>
> Sorry, but I'm not in favour of this as it adds confusion.
> See above for the potential way to solve.

well, I was thinking the same yesterday. It just adds another
level on confusion into the code, which even the author got
wrong :)

Array with holes would be more obvious, but one can also embedd
the necessary values into struct ep93xx_gpio_bank.

--
Alexander Sverdlin.


\
 
 \ /
  Last update: 2021-01-28 17:21    [W:0.069 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site