gpio: rcar: Use new line value setter callbacks
Subsystems (2)
Geert Uytterhoeven
maintainerv2 cover gpio: rcar: Use new line value setter callbacks
Hi all,
This patch series converts the R-Car GPIo driver to the new line value setter callbacks.
Changes compared to v1:
- New patch "gpio: rcar: Remove checks for empty bankmasks".
Thanks for your comments!
Geert Uytterhoeven (2):
gpio: rcar: Remove checks for empty bankmasks
gpio: rcar: Use new line value setter callbacks
drivers/gpio/gpio-rcar.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
Signature · 12 lines
2.43.0
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsGeert Uytterhoeven
maintainerPATCH v2 1/2 gpio: rcar: Remove checks for empty bankmasks
The GPIO core never passes empty bankmasks to the callbacks for handling multiple signals at once. Remove the superfluous checks, and refactor the code.
---
v2:
- New.
--- drivers/gpio/gpio-rcar.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/gpio/gpio-rcar.c +4 -10
@@ -331,14 +331,11 @@ static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset)static int gpio_rcar_get_multiple (struct gpio_chip *chip,unsigned long *mask,unsigned long *bits) { +u32 bankmask = mask[0 ] &GENMASK (chip->ngpio -1 ,0 );struct gpio_rcar_priv *p =gpiochip_get_data (chip); -u32 bankmask, outputs, m, val =0 ; +u32 outputs, m, val =0 ;unsigned long flags; - bankmask = mask[0 ] &GENMASK (chip->ngpio -1 ,0 ); -if (!bankmask) -return 0 ; -if (p->info.has_always_in) { bits[0 ] =gpio_rcar_read (p,INDT ) & bankmask;return 0 ;
@@ -372,13 +369,10 @@ static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)static void gpio_rcar_set_multiple (struct gpio_chip *chip,unsigned long *mask,unsigned long *bits) { +u32 bankmask = mask[0 ] &GENMASK (chip->ngpio -1 ,0 );struct gpio_rcar_priv *p =gpiochip_get_data (chip);unsigned long flags; -u32 val, bankmask; - - bankmask = mask[0 ] &GENMASK (chip->ngpio -1 ,0 ); -if (!bankmask) -return ; +u32 val;raw_spin_lock_irqsave (&p->lock, flags); val =gpio_rcar_read (p,OUTDT );
Signature · 1 line
2.43.0
Re: [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks
Quoted 5 lines · Geert Uytterhoeven
The GPIO core never passes empty bankmasks to the callbacks for handling multiple signals at once. Remove the superfluous checks, and refactor the code.
Signed-off-by Geert Uytterhoeven <[email protected]>
Nice cleanup!
Geert Uytterhoeven
maintainerPATCH v2 2/2 gpio: rcar: Use new line value setter callbacks
In reply to Geert Uytterhoevenstruct gpio_chip now has callbacks for setting line values that return integers, so they can indicate failures. Convert the driver to using them.
---
v2:
- Rebase.
--- drivers/gpio/gpio-rcar.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpio/gpio-rcar.c +9 -5
@@ -356,7 +356,7 @@ static int gpio_rcar_get_multiple(struct gpio_chip *chip, unsigned long *mask,return 0 ; } -static void gpio_rcar_set (struct gpio_chip *chip,unsigned offset,int value) +static int gpio_rcar_set (struct gpio_chip *chip,unsigned int offset,int value) {struct gpio_rcar_priv *p =gpiochip_get_data (chip);unsigned long flags;
@@ -364,10 +364,12 @@ static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)raw_spin_lock_irqsave (&p->lock, flags);gpio_rcar_modify_bit (p,OUTDT , offset, value);raw_spin_unlock_irqrestore (&p->lock, flags); + +return 0 ; } -static void gpio_rcar_set_multiple (struct gpio_chip *chip,unsigned long *mask, -unsigned long *bits) +static int gpio_rcar_set_multiple (struct gpio_chip *chip,unsigned long *mask, +unsigned long *bits) {u32 bankmask = mask[0 ] &GENMASK (chip->ngpio -1 ,0 );struct gpio_rcar_priv *p =gpiochip_get_data (chip);
@@ -380,6 +382,8 @@ static void gpio_rcar_set_multiple(struct gpio_chip *chip, unsigned long *mask, val |= (bankmask & bits[0 ]);gpio_rcar_write (p,OUTDT , val);raw_spin_unlock_irqrestore (&p->lock, flags); + +return 0 ; } static int gpio_rcar_direction_output(struct gpio_chip *chip, unsigned offset,
@@ -531,8 +535,8 @@ static int gpio_rcar_probe(struct platform_device *pdev) gpio_chip->get = gpio_rcar_get; gpio_chip->get_multiple = gpio_rcar_get_multiple; gpio_chip->direction_output = gpio_rcar_direction_output; - gpio_chip->set = gpio_rcar_set; - gpio_chip->set_multiple = gpio_rcar_set_multiple; + gpio_chip->set_rv = gpio_rcar_set; + gpio_chip->set_multiple_rv = gpio_rcar_set_multiple; gpio_chip->label = name; gpio_chip->parent = dev; gpio_chip->owner =THIS_MODULE ;
Signature · 1 line
2.43.0
Quoted 5 lines · Geert Uytterhoeven
struct
gpio_chipnow has callbacks for setting line values that return integers, so they can indicate failures. Convert the driver to using them.Signed-off-by Geert Uytterhoeven <[email protected]>
Even found the hidden 'unsigned' to 'unsigned int' conversion ;)
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 9 lines · Geert Uytterhoeven
Hi all,
This patch series converts the R-Car GPIo driver to the new line value setter callbacks.
Changes compared to v1:
- New patch "gpio: rcar: Remove checks for empty bankmasks".[...]
Applied, thanks!
[1/2] gpio: rcar: Remove checks for empty bankmasks
https://git.kernel.org/brgl/linux/c/28a9ab01f6ac87afb78cb18098bc37a74db0d8f0 [2/2] gpio: rcar: Use new line value setter callbacks https://git.kernel.org/brgl/linux/c/3315e39e5639ac770782b658e499d45f68ea7d82
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>