Messages in this thread | | | Subject | Re: [PATCH v3 1/7] gpio: gpio-ep93xx: fix BUG_ON port F usage | From | Alexander Sverdlin <> | Date | Thu, 28 Jan 2021 17:19:45 +0100 |
| |
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.
| |