[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YG8cWBkcF8ulHW0D@smile.fi.intel.com>
Date: Thu, 8 Apr 2021 18:08:08 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: linux-gpio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>,
Srinivas Neeli <srinivas.neeli@...inx.com>,
Michal Simek <michal.simek@...inx.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Syed Nayyar Waris <syednwaris@...il.com>,
vilhelm.gray@...il.com
Subject: Re: [PATCH v1 4/5] gpio: xilinx: Switch to use bitmap APIs
On Thu, Apr 08, 2021 at 05:56:00PM +0300, Andy Shevchenko wrote:
> It seems that Xilinx GPIO driver operates with bit arrays longer than 32 and
> thus can leverage bitmap APIs for that. It makes code better to understand.
>
> The ->probe() function is modified to try read properties for both channels
> since is_dual check makes only sense for the amount of pins used for the second
> channel. On top of that kzalloc() guarantees zero initial values for the fields
> in the private data structure, hence drop unneeded conditionals and assignments.
>
> The change is inspired by Syed Nayyar Waris' ideas about bitmap API extension.
As I was afraid in the cover letter, I found some mistakes already.
In any case, I'll wait for the comments and test of other patches if possible.
Out of curiosity, below I point out the issues.
...
> + return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, chip->gc.ngpio);
Seems we have to use 64 instead of ngpio here.
...
> + bitmap_replace(state, chip->state, hw_bits, hw_mask, gc->ngpio);
Ditto.
...
> + bitmap_copy(chip->state, state, gc->ngpio);
Ditto.
...
> + for_each_set_bit(bit, all, 64)
> + generic_handle_irq(irq_find_mapping(gc->irq.domain, bit));
Here should be used gpio actually and ngpio IIUC.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists