linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] gpiolib: add gpiods_set_array_value_cansleep
@ 2025-01-31 20:24 David Lechner
  2025-01-31 20:24 ` [PATCH 01/13] gpiolib: add gpiods_set_array_value_cansleep() David Lechner
                   ` (15 more replies)
  0 siblings, 16 replies; 37+ messages in thread
From: David Lechner @ 2025-01-31 20:24 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
	Geert Uytterhoeven, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Ulf Hansson, Peter Rosin, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Vinod Koul, Kishon Vijay Abraham I,
	Nuno Sá, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: linux-gpio, linux-kernel, linux-iio, linux-mmc, netdev, linux-phy,
	linux-sound, David Lechner

This series was inspired by some minor annoyance I have experienced a
few times in recent reviews.

Calling gpiod_set_array_value_cansleep() can be quite verbose due to
having so many parameters. In most cases, we already have a struct
gpio_descs that contains the first 3 parameters so we end up with 3 (or
often even 6) pointer indirections at each call site. Also, people have
a tendency to want to hard-code the first argument instead of using
struct gpio_descs.ndescs, often without checking that ndescs >= the
hard-coded value.

So I'm proposing that we add a gpiods_set_array_value_cansleep()
function that is a wrapper around gpiod_set_array_value_cansleep()
that has struct gpio_descs as the first parameter to make it a bit
easier to read the code and avoid the hard-coding temptation.

I've just done gpiods_set_array_value_cansleep() for now since there
were over 10 callers of this one. There aren't as many callers of
the get and atomic variants, but we can add those too if this seems
like a useful thing to do.

---
David Lechner (13):
      gpiolib: add gpiods_set_array_value_cansleep()
      auxdisplay: seg-led-gpio: use gpiods_set_array_value_cansleep
      bus: ts-nbus: validate ts,data-gpios array size
      bus: ts-nbus: use gpiods_set_array_value_cansleep
      gpio: max3191x: use gpiods_set_array_value_cansleep
      iio: adc: ad7606: use gpiods_set_array_value_cansleep
      iio: amplifiers: hmc425a: use gpiods_set_array_value_cansleep
      iio: resolver: ad2s1210: use gpiods_set_array_value_cansleep
      mmc: pwrseq_simple: use gpiods_set_array_value_cansleep
      mux: gpio: use gpiods_set_array_value_cansleep
      net: mdio: mux-gpio: use gpiods_set_array_value_cansleep
      phy: mapphone-mdm6600: use gpiods_set_array_value_cansleep
      ASoC: adau1701: use gpiods_set_array_value_cansleep

 drivers/auxdisplay/seg-led-gpio.c           |  3 +--
 drivers/bus/ts-nbus.c                       | 10 ++++++----
 drivers/gpio/gpio-max3191x.c                | 18 +++++++-----------
 drivers/iio/adc/ad7606.c                    |  3 +--
 drivers/iio/adc/ad7606_spi.c                |  3 +--
 drivers/iio/amplifiers/hmc425a.c            |  3 +--
 drivers/iio/resolver/ad2s1210.c             |  8 ++------
 drivers/mmc/core/pwrseq_simple.c            |  3 +--
 drivers/mux/gpio.c                          |  4 +---
 drivers/net/mdio/mdio-mux-gpio.c            |  3 +--
 drivers/phy/motorola/phy-mapphone-mdm6600.c |  4 +---
 include/linux/gpio/consumer.h               |  7 +++++++
 sound/soc/codecs/adau1701.c                 |  4 +---
 13 files changed, 31 insertions(+), 42 deletions(-)
---
base-commit: df4b2bbff898227db0c14264ac7edd634e79f755
change-id: 20250131-gpio-set-array-helper-bd4a328370d3

Best regards,
-- 
David Lechner <dlechner@baylibre.com>


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2025-02-04 15:38 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-31 20:24 [PATCH 00/13] gpiolib: add gpiods_set_array_value_cansleep David Lechner
2025-01-31 20:24 ` [PATCH 01/13] gpiolib: add gpiods_set_array_value_cansleep() David Lechner
2025-02-02 10:06   ` Andy Shevchenko
2025-01-31 20:24 ` [PATCH 02/13] auxdisplay: seg-led-gpio: use gpiods_set_array_value_cansleep David Lechner
2025-02-02 10:08   ` Andy Shevchenko
2025-02-03 10:34   ` Geert Uytterhoeven
2025-02-03 12:10     ` Andy Shevchenko
2025-01-31 20:24 ` [PATCH 03/13] bus: ts-nbus: validate ts,data-gpios array size David Lechner
2025-01-31 20:24 ` [PATCH 04/13] bus: ts-nbus: use gpiods_set_array_value_cansleep David Lechner
2025-01-31 20:24 ` [PATCH 05/13] gpio: max3191x: " David Lechner
2025-02-02 10:12   ` Andy Shevchenko
2025-01-31 20:24 ` [PATCH 06/13] iio: adc: ad7606: " David Lechner
2025-01-31 20:24 ` [PATCH 07/13] iio: amplifiers: hmc425a: " David Lechner
2025-01-31 20:24 ` [PATCH 08/13] iio: resolver: ad2s1210: " David Lechner
2025-01-31 20:24 ` [PATCH 09/13] mmc: pwrseq_simple: " David Lechner
2025-02-04 15:37   ` Ulf Hansson
2025-01-31 20:24 ` [PATCH 10/13] mux: gpio: " David Lechner
2025-02-01  0:34   ` Peter Rosin
2025-01-31 20:24 ` [PATCH 11/13] net: mdio: mux-gpio: " David Lechner
2025-01-31 20:24 ` [PATCH 12/13] phy: mapphone-mdm6600: " David Lechner
2025-02-02 10:20   ` Andy Shevchenko
2025-01-31 20:24 ` [PATCH 13/13] ASoC: adau1701: " David Lechner
2025-02-02 10:24   ` Andy Shevchenko
2025-02-03 12:24   ` Mark Brown
2025-01-31 20:38 ` [PATCH 00/13] gpiolib: add gpiods_set_array_value_cansleep Andrew Lunn
2025-01-31 20:51   ` David Lechner
2025-02-01 12:45     ` Jonathan Cameron
2025-01-31 22:45 ` Linus Walleij
2025-02-01 10:36 ` Bartosz Golaszewski
2025-02-01 15:10   ` Andy Shevchenko
2025-02-01 16:09   ` David Lechner
2025-02-01 16:14     ` Bartosz Golaszewski
2025-02-01 16:17       ` David Lechner
2025-02-01 16:22         ` Bartosz Golaszewski
2025-02-01 19:47           ` Andy Shevchenko
2025-02-03 22:39             ` David Lechner
2025-02-04  8:52               ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).