mbox series

[v1,0/5] gpio, pinctrl, introduce for_each_requested_gpio() helper

Message ID 20200615150545.87964-1-andriy.shevchenko@linux.intel.com
Headers show
Series gpio, pinctrl, introduce for_each_requested_gpio() helper | expand

Message

Andy Shevchenko June 15, 2020, 3:05 p.m. UTC
While cleaning up Intel pin control drivers I have noticed that one helper
macro can be used widely in GPIO and pin control subsystems. Here we are.

Intel stuff is deliberately excluded, so, this can be applied to the GPIO
subsystem into immutable branch that will be propagated to pin control
subsystem and TWIMC parties, such as Intel pin control drivers.

Andy Shevchenko (5):
  gpiolib: Introduce for_each_requested_gpio_in_range() macro
  ARM/orion/gpio: Make use of for_each_requested_gpio()
  gpio: mvebu: Make use of for_each_requested_gpio()
  gpio: xra1403: Make use of for_each_requested_gpio()
  pinctrl: at91: Make use of for_each_requested_gpio()

 arch/arm/plat-orion/gpio.c     |  8 ++------
 drivers/gpio/gpio-mvebu.c      |  8 ++------
 drivers/gpio/gpio-xra1403.c    |  8 ++------
 drivers/pinctrl/pinctrl-at91.c |  7 ++-----
 include/linux/gpio/driver.h    | 16 ++++++++++++++++
 5 files changed, 24 insertions(+), 23 deletions(-)

Comments

Gregory CLEMENT July 18, 2020, 8:52 p.m. UTC | #1
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

> Make use of for_each_requested_gpio() instead of home grown analogue.

>

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Cc: Jason Cooper <jason@lakedaemon.net>

> Cc: Andrew Lunn <andrew@lunn.ch>

> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

> Cc: Gregory Clement <gregory.clement@bootlin.com>


Applied on mvebu/arm

Thanks,

Gregory
> ---

>  arch/arm/plat-orion/gpio.c | 8 ++------

>  1 file changed, 2 insertions(+), 6 deletions(-)

>

> diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c

> index 26a531ebb6e9..734f0be4f14a 100644

> --- a/arch/arm/plat-orion/gpio.c

> +++ b/arch/arm/plat-orion/gpio.c

> @@ -442,6 +442,7 @@ static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)

>  

>  	struct orion_gpio_chip *ochip = gpiochip_get_data(chip);

>  	u32 out, io_conf, blink, in_pol, data_in, cause, edg_msk, lvl_msk;

> +	const char *label;

>  	int i;

>  

>  	out	= readl_relaxed(GPIO_OUT(ochip));

> @@ -453,15 +454,10 @@ static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)

>  	edg_msk	= readl_relaxed(GPIO_EDGE_MASK(ochip));

>  	lvl_msk	= readl_relaxed(GPIO_LEVEL_MASK(ochip));

>  

> -	for (i = 0; i < chip->ngpio; i++) {

> -		const char *label;

> +	for_each_requested_gpio(chip, i, label) {

>  		u32 msk;

>  		bool is_out;

>  

> -		label = gpiochip_is_requested(chip, i);

> -		if (!label)

> -			continue;

> -

>  		msk = 1 << i;

>  		is_out = !(io_conf & msk);

>  

> -- 

> 2.27.0.rc2

>


-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
Andy Shevchenko July 18, 2020, 9:31 p.m. UTC | #2
On Sat, Jul 18, 2020 at 11:53 PM Gregory CLEMENT
<gregory.clement@bootlin.com> wrote:
>

> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

>

> > Make use of for_each_requested_gpio() instead of home grown analogue.

> >

> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> > Cc: Jason Cooper <jason@lakedaemon.net>

> > Cc: Andrew Lunn <andrew@lunn.ch>

> > Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

> > Cc: Gregory Clement <gregory.clement@bootlin.com>

>

> Applied on mvebu/arm


I guess you need to merge an immutable branch from Linus. Does above imply this?



-- 
With Best Regards,
Andy Shevchenko