All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
	Srinivas Neeli <srinivas.neeli@xilinx.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Syed Nayyar Waris <syednwaris@gmail.com>,
	vilhelm.gray@gmail.com
Subject: Re: [PATCH v1 4/5] gpio: xilinx: Switch to use bitmap APIs
Date: Thu, 8 Apr 2021 18:08:08 +0300	[thread overview]
Message-ID: <YG8cWBkcF8ulHW0D@smile.fi.intel.com> (raw)
In-Reply-To: <20210408145601.68651-5-andriy.shevchenko@linux.intel.com>

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



WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
	Srinivas Neeli <srinivas.neeli@xilinx.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Syed Nayyar Waris <syednwaris@gmail.com>,
	vilhelm.gray@gmail.com
Subject: Re: [PATCH v1 4/5] gpio: xilinx: Switch to use bitmap APIs
Date: Thu, 8 Apr 2021 18:08:08 +0300	[thread overview]
Message-ID: <YG8cWBkcF8ulHW0D@smile.fi.intel.com> (raw)
In-Reply-To: <20210408145601.68651-5-andriy.shevchenko@linux.intel.com>

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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-04-08 15:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 14:55 [RFT, PATCH v1 0/5] gpio: xilinx: convert to use bitmap API Andy Shevchenko
2021-04-08 14:55 ` Andy Shevchenko
2021-04-08 14:55 ` [PATCH v1 1/5] bitmap: Make bitmap_remap() and bitmap_bitremap() available to users Andy Shevchenko
2021-04-08 14:55   ` Andy Shevchenko
2021-04-08 16:52   ` Yury Norov
2021-04-08 16:52     ` Yury Norov
2021-04-08 14:55 ` [PATCH v1 2/5] gpio: xilinx: Correct kernel doc for xgpio_probe() Andy Shevchenko
2021-04-08 14:55   ` Andy Shevchenko
2021-04-08 16:16   ` Michal Simek
2021-04-08 16:16     ` Michal Simek
2021-04-08 14:55 ` [PATCH v1 3/5] gpio: xilinx: Introduce xgpio_read_chan() / xgpio_write_chan() Andy Shevchenko
2021-04-08 14:55   ` Andy Shevchenko
2021-04-08 14:56 ` [PATCH v1 4/5] gpio: xilinx: Switch to use bitmap APIs Andy Shevchenko
2021-04-08 14:56   ` Andy Shevchenko
2021-04-08 15:08   ` Andy Shevchenko [this message]
2021-04-08 15:08     ` Andy Shevchenko
2021-04-08 15:31     ` [PATCH 1/1] drivers/gpio/gpio-xilinx.c (updated): bitmap-fix Andy Shevchenko
2021-04-08 15:31       ` Andy Shevchenko
2021-04-08 14:56 ` [PATCH v1 5/5] gpio: xilinx: No need to disable IRQs in the handler Andy Shevchenko
2021-04-08 14:56   ` Andy Shevchenko
2021-04-23 20:41 ` [RFT, PATCH v1 0/5] gpio: xilinx: convert to use bitmap API Bartosz Golaszewski
2021-04-23 20:41   ` Bartosz Golaszewski
2021-04-24 11:08   ` Andy Shevchenko
2021-04-24 11:08     ` Andy Shevchenko
2021-04-24 11:14   ` Andy Shevchenko
2021-04-24 11:14     ` Andy Shevchenko
2021-04-29 13:59     ` Srinivas Neeli
2021-04-29 13:59       ` Srinivas Neeli
2021-04-29 14:30       ` Andy Shevchenko
2021-04-29 14:30         ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YG8cWBkcF8ulHW0D@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=michal.simek@xilinx.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    --cc=srinivas.neeli@xilinx.com \
    --cc=syednwaris@gmail.com \
    --cc=vilhelm.gray@gmail.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.