Skip to contentSkip to conversation

leds: aw200xx: don't use return with gpiod_set_value() variants

PATCH In review Bartosz Golaszewski 2 participants 6 messages Feb 12, 2025 – Feb 20, 2025 LED

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: aw200xx: don't use return with gpiod_set_value() variants

From: Bartosz Golaszewski <[email protected]>

While it now returns void, it will soon be converted to return an integer instead. Don't do return gpiod_set....

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -1
index 08cca128458c..fe223d363a5d 100644
@@ -379,7 +379,7 @@ static void aw200xx_enable(const struct aw200xx *const chip)
 
 static void aw200xx_disable(const struct aw200xx *const chip)
 {
-	return gpiod_set_value_cansleep(chip->hwen, 0);
+	gpiod_set_value_cansleep(chip->hwen, 0);
 }
 
 static int aw200xx_probe_get_display_rows(struct device *dev,
Signature · 1 line
2.45.2
#1 lore raw
Quoted 27 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

While it now returns void, it will soon be converted to return an integer instead. Don't do return gpiod_set....

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -2
index 08cca128458c..fe223d363a5d 100644
@@ -379,7 +379,7 @@ static void aw200xx_enable(const struct aw200xx *const chip)
 
 static void aw200xx_disable(const struct aw200xx *const chip)
 {
-       return gpiod_set_value_cansleep(chip->hwen, 0);
+       gpiod_set_value_cansleep(chip->hwen, 0);
 }
 
 static int aw200xx_probe_get_display_rows(struct device *dev,
--
Quoted 2 lines

2.45.2

Lee, Pavel:

If this is OK for you, can you please provide me with an immutable branch so that I can pull it into the GPIO tree? It seems it's the only such use-case in the tree apart from the gpio.h header that I can fix locally. Alternatively you can just Ack this and let me take it through the GPIO tree.

Bartosz

maintainer
#2 lore raw
Quoted 33 lines · Bartosz Golaszewski
Quoted 27 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

While it now returns void, it will soon be converted to return an integer instead. Don't do return gpiod_set....

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -2
index 08cca128458c..fe223d363a5d 100644
@@ -379,7 +379,7 @@ static void aw200xx_enable(const struct aw200xx *const chip)
 
 static void aw200xx_disable(const struct aw200xx *const chip)
 {
-       return gpiod_set_value_cansleep(chip->hwen, 0);
+       gpiod_set_value_cansleep(chip->hwen, 0);
 }
 
 static int aw200xx_probe_get_display_rows(struct device *dev,
--
Quoted 2 lines

2.45.2

Lee, Pavel:

Quoted 5 lines

If this is OK for you, can you please provide me with an immutable branch so that I can pull it into the GPIO tree? It seems it's the only such use-case in the tree apart from the gpio.h header that I can fix locally. Alternatively you can just Ack this and let me take it through the GPIO tree.

I'm okay with it, but why do you need it?

Signature · 1 line
Lee Jones [李琼斯]
#3 lore raw
Quoted 36 lines · Lee Jones
Quoted 33 lines · Bartosz Golaszewski
Quoted 27 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

While it now returns void, it will soon be converted to return an integer instead. Don't do return gpiod_set....

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -2
index 08cca128458c..fe223d363a5d 100644
@@ -379,7 +379,7 @@ static void aw200xx_enable(const struct aw200xx *const chip)
 
 static void aw200xx_disable(const struct aw200xx *const chip)
 {
-       return gpiod_set_value_cansleep(chip->hwen, 0);
+       gpiod_set_value_cansleep(chip->hwen, 0);
 }
 
 static int aw200xx_probe_get_display_rows(struct device *dev,
--
Quoted 2 lines

2.45.2

Lee, Pavel:

Quoted 8 lines
Quoted 5 lines

If this is OK for you, can you please provide me with an immutable branch so that I can pull it into the GPIO tree? It seems it's the only such use-case in the tree apart from the gpio.h header that I can fix locally. Alternatively you can just Ack this and let me take it through the GPIO tree.

I'm okay with it, but why do you need it?

For historical reasons gpiod_set_value() and its variants don't have a return value. However, we now support all kinds of hardware that can fail to set a line value: I2C, SPI, USB (hot-unpluggable chips), etc. I want to rework the GPIO subsystem to make these functions return int and become able to indicate failures. Build-bot complained about my series[1] and pointed at this driver after the interface for gpiod_set_value_cansleep() changed in patch 1. This is why I want to fix it, get it into my tree and then pick up the series.

Sorry for not explaining it in detail earlier.

Bart

[1] https://lore.kernel.org/linux-gpio/[email protected]/

#4 lore raw
Quoted 56 lines · Bartosz Golaszewski
Quoted 36 lines · Lee Jones
Quoted 33 lines · Bartosz Golaszewski
Quoted 27 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

While it now returns void, it will soon be converted to return an integer instead. Don't do return gpiod_set....

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -2
index 08cca128458c..fe223d363a5d 100644
@@ -379,7 +379,7 @@ static void aw200xx_enable(const struct aw200xx *const chip)
 
 static void aw200xx_disable(const struct aw200xx *const chip)
 {
-       return gpiod_set_value_cansleep(chip->hwen, 0);
+       gpiod_set_value_cansleep(chip->hwen, 0);
 }
 
 static int aw200xx_probe_get_display_rows(struct device *dev,
--
Quoted 2 lines

2.45.2

Lee, Pavel:

Quoted 8 lines
Quoted 5 lines

If this is OK for you, can you please provide me with an immutable branch so that I can pull it into the GPIO tree? It seems it's the only such use-case in the tree apart from the gpio.h header that I can fix locally. Alternatively you can just Ack this and let me take it through the GPIO tree.

I'm okay with it, but why do you need it?

For historical reasons gpiod_set_value() and its variants don't have a return value. However, we now support all kinds of hardware that can fail to set a line value: I2C, SPI, USB (hot-unpluggable chips), etc. I want to rework the GPIO subsystem to make these functions return int and become able to indicate failures. Build-bot complained about my series[1] and pointed at this driver after the interface for gpiod_set_value_cansleep() changed in patch 1. This is why I want to fix it, get it into my tree and then pick up the series.

Quoted 5 lines

Sorry for not explaining it in detail earlier.

Bart

[1] https://lore.kernel.org/linux-gpio/[email protected]/

Is it fine for you if I take it through the GPIO tree? Could you please leave your Ack under the patch if so?

Thanks in advance,
Bartosz

maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Bartosz Golaszewski
Quoted 11 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

While it now returns void, it will soon be converted to return an integer instead. Don't do return gpiod_set....

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
Lee Jones [李琼斯]