[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0c121fdfb2893ec89425534387212524e4ff7cf.camel@gmail.com>
Date: Thu, 28 Jan 2021 17:19:45 +0100
From: Alexander Sverdlin <alexander.sverdlin@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
Nikita Shubin <nikita.shubin@...uefel.me>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/7] gpio: gpio-ep93xx: fix BUG_ON port F usage
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.
Powered by blists - more mailing lists