linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] gpio: rcar: Use new line value setter callbacks
@ 2025-06-25  8:05 Geert Uytterhoeven
  2025-06-25  8:05 ` [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2025-06-25  8:05 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Magnus Damm, Wolfram Sang
  Cc: linux-gpio, linux-renesas-soc, 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".

Thanks for your comments!

[1] https://lore.kernel.org/b648ffcfe6268d3886b134a98908b2f91dbece56.1749801865.git.geert+renesas@glider.be

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(-)

-- 
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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 Torvalds

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

* [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks
  2025-06-25  8:05 [PATCH v2 0/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
@ 2025-06-25  8:05 ` Geert Uytterhoeven
  2025-06-25  9:06   ` Wolfram Sang
  2025-06-25  8:05 ` [PATCH v2 2/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
  2025-06-26  8:53 ` [PATCH v2 0/2] " Bartosz Golaszewski
  2 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2025-06-25  8:05 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Magnus Damm, Wolfram Sang
  Cc: linux-gpio, linux-renesas-soc, 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 <geert+renesas@glider.be>
---
v2:
  - New.
---
 drivers/gpio/gpio-rcar.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 18c965ee02c8d368..8416e0430887bd5e 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -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);
-- 
2.43.0


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

* [PATCH v2 2/2] gpio: rcar: Use new line value setter callbacks
  2025-06-25  8:05 [PATCH v2 0/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
  2025-06-25  8:05 ` [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks Geert Uytterhoeven
@ 2025-06-25  8:05 ` Geert Uytterhoeven
  2025-06-25  9:08   ` Wolfram Sang
  2025-06-26  8:53 ` [PATCH v2 0/2] " Bartosz Golaszewski
  2 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2025-06-25  8:05 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Magnus Damm, Wolfram Sang
  Cc: linux-gpio, linux-renesas-soc, Geert Uytterhoeven

struct gpio_chip now 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 <geert+renesas@glider.be>
---
v2:
  - Rebase.
---
 drivers/gpio/gpio-rcar.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 8416e0430887bd5e..1d121a4275905e09 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -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;
-- 
2.43.0


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

* Re: [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks
  2025-06-25  8:05 ` [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks Geert Uytterhoeven
@ 2025-06-25  9:06   ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2025-06-25  9:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, Bartosz Golaszewski, Magnus Damm, linux-gpio,
	linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Wed, Jun 25, 2025 at 10:05:46AM +0200, Geert Uytterhoeven wrote:
> 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 <geert+renesas@glider.be>

Nice cleanup!

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 2/2] gpio: rcar: Use new line value setter callbacks
  2025-06-25  8:05 ` [PATCH v2 2/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
@ 2025-06-25  9:08   ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2025-06-25  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, Bartosz Golaszewski, Magnus Damm, linux-gpio,
	linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

On Wed, Jun 25, 2025 at 10:05:47AM +0200, Geert Uytterhoeven wrote:
> struct gpio_chip now 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 <geert+renesas@glider.be>

Even found the hidden 'unsigned' to 'unsigned int' conversion ;)

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 0/2] gpio: rcar: Use new line value setter callbacks
  2025-06-25  8:05 [PATCH v2 0/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
  2025-06-25  8:05 ` [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks Geert Uytterhoeven
  2025-06-25  8:05 ` [PATCH v2 2/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
@ 2025-06-26  8:53 ` Bartosz Golaszewski
  2 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-06-26  8:53 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Magnus Damm, Wolfram Sang,
	Geert Uytterhoeven
  Cc: Bartosz Golaszewski, linux-gpio, linux-renesas-soc

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Wed, 25 Jun 2025 10:05:45 +0200, Geert Uytterhoeven wrote:
> 	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,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

end of thread, other threads:[~2025-06-26  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25  8:05 [PATCH v2 0/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
2025-06-25  8:05 ` [PATCH v2 1/2] gpio: rcar: Remove checks for empty bankmasks Geert Uytterhoeven
2025-06-25  9:06   ` Wolfram Sang
2025-06-25  8:05 ` [PATCH v2 2/2] gpio: rcar: Use new line value setter callbacks Geert Uytterhoeven
2025-06-25  9:08   ` Wolfram Sang
2025-06-26  8:53 ` [PATCH v2 0/2] " 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).