* [PATCH 1/4] leds: lgm-sso: use new line value setter callbacks
2025-04-23 7:53 [PATCH 0/4] leds: use new GPIO setter callbacks Bartosz Golaszewski
@ 2025-04-23 7:53 ` Bartosz Golaszewski
2025-04-23 7:53 ` [PATCH 2/4] leds: pca955x: " Bartosz Golaszewski
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-23 7:53 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Linus Walleij, Bartosz Golaszewski,
Riku Voipio
Cc: linux-leds, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/leds/blink/leds-lgm-sso.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c
index effaaaf302b5..c9027f9c4bb7 100644
--- a/drivers/leds/blink/leds-lgm-sso.c
+++ b/drivers/leds/blink/leds-lgm-sso.c
@@ -450,7 +450,7 @@ static int sso_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(reg_val & BIT(offset));
}
-static void sso_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
+static int sso_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct sso_led_priv *priv = gpiochip_get_data(chip);
@@ -458,6 +458,8 @@ static void sso_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
if (!priv->gpio.freq)
regmap_update_bits(priv->mmap, SSO_CON0, SSO_CON0_SWU,
SSO_CON0_SWU);
+
+ return 0;
}
static int sso_gpio_gc_init(struct device *dev, struct sso_led_priv *priv)
@@ -469,7 +471,7 @@ static int sso_gpio_gc_init(struct device *dev, struct sso_led_priv *priv)
gc->get_direction = sso_gpio_get_dir;
gc->direction_output = sso_gpio_dir_out;
gc->get = sso_gpio_get;
- gc->set = sso_gpio_set;
+ gc->set_rv = sso_gpio_set;
gc->label = "lgm-sso";
gc->base = -1;
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] leds: pca955x: use new line value setter callbacks
2025-04-23 7:53 [PATCH 0/4] leds: use new GPIO setter callbacks Bartosz Golaszewski
2025-04-23 7:53 ` [PATCH 1/4] leds: lgm-sso: use new line value " Bartosz Golaszewski
@ 2025-04-23 7:53 ` Bartosz Golaszewski
2025-04-23 7:53 ` [PATCH 3/4] leds: pca9532: " Bartosz Golaszewski
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-23 7:53 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Linus Walleij, Bartosz Golaszewski,
Riku Voipio
Cc: linux-leds, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/leds/leds-pca955x.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 24a40a1cdb15..42fe056b1c74 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -495,10 +495,10 @@ static int pca955x_set_value(struct gpio_chip *gc, unsigned int offset,
return pca955x_led_set(&led->led_cdev, PCA955X_GPIO_LOW);
}
-static void pca955x_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
- int val)
+static int pca955x_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
+ int val)
{
- pca955x_set_value(gc, offset, val);
+ return pca955x_set_value(gc, offset, val);
}
static int pca955x_gpio_get_value(struct gpio_chip *gc, unsigned int offset)
@@ -737,7 +737,7 @@ static int pca955x_probe(struct i2c_client *client)
pca955x->gpio.label = "gpio-pca955x";
pca955x->gpio.direction_input = pca955x_gpio_direction_input;
pca955x->gpio.direction_output = pca955x_gpio_direction_output;
- pca955x->gpio.set = pca955x_gpio_set_value;
+ pca955x->gpio.set_rv = pca955x_gpio_set_value;
pca955x->gpio.get = pca955x_gpio_get_value;
pca955x->gpio.request = pca955x_gpio_request_pin;
pca955x->gpio.free = pca955x_gpio_free_pin;
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] leds: pca9532: use new line value setter callbacks
2025-04-23 7:53 [PATCH 0/4] leds: use new GPIO setter callbacks Bartosz Golaszewski
2025-04-23 7:53 ` [PATCH 1/4] leds: lgm-sso: use new line value " Bartosz Golaszewski
2025-04-23 7:53 ` [PATCH 2/4] leds: pca955x: " Bartosz Golaszewski
@ 2025-04-23 7:53 ` Bartosz Golaszewski
2025-04-23 7:53 ` [PATCH 4/4] leds: tca6507: " Bartosz Golaszewski
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-23 7:53 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Linus Walleij, Bartosz Golaszewski,
Riku Voipio
Cc: linux-leds, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/leds/leds-pca9532.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 1b47acf54720..7d4c071a6cd0 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -318,7 +318,8 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
return -EBUSY;
}
-static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val)
+static int pca9532_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
+ int val)
{
struct pca9532_data *data = gpiochip_get_data(gc);
struct pca9532_led *led = &data->leds[offset];
@@ -329,6 +330,8 @@ static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int va
led->state = PCA9532_OFF;
pca9532_setled(led);
+
+ return 0;
}
static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset)
@@ -351,9 +354,7 @@ static int pca9532_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
static int pca9532_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int val)
{
- pca9532_gpio_set_value(gc, offset, val);
-
- return 0;
+ return pca9532_gpio_set_value(gc, offset, val);
}
#endif /* CONFIG_LEDS_PCA9532_GPIO */
@@ -472,7 +473,7 @@ static int pca9532_configure(struct i2c_client *client,
data->gpio.label = "gpio-pca9532";
data->gpio.direction_input = pca9532_gpio_direction_input;
data->gpio.direction_output = pca9532_gpio_direction_output;
- data->gpio.set = pca9532_gpio_set_value;
+ data->gpio.set_rv = pca9532_gpio_set_value;
data->gpio.get = pca9532_gpio_get_value;
data->gpio.request = pca9532_gpio_request_pin;
data->gpio.can_sleep = 1;
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] leds: tca6507: use new line value setter callbacks
2025-04-23 7:53 [PATCH 0/4] leds: use new GPIO setter callbacks Bartosz Golaszewski
` (2 preceding siblings ...)
2025-04-23 7:53 ` [PATCH 3/4] leds: pca9532: " Bartosz Golaszewski
@ 2025-04-23 7:53 ` Bartosz Golaszewski
2025-04-23 9:12 ` [PATCH 0/4] leds: use new GPIO " Linus Walleij
2025-04-24 16:27 ` Lee Jones
5 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-23 7:53 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Linus Walleij, Bartosz Golaszewski,
Riku Voipio
Cc: linux-leds, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/leds/leds-tca6507.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index acbd8169723c..89c165c8ee9c 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -588,8 +588,8 @@ static int tca6507_blink_set(struct led_classdev *led_cdev,
}
#ifdef CONFIG_GPIOLIB
-static void tca6507_gpio_set_value(struct gpio_chip *gc,
- unsigned offset, int val)
+static int tca6507_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
+ int val)
{
struct tca6507_chip *tca = gpiochip_get_data(gc);
unsigned long flags;
@@ -604,13 +604,14 @@ static void tca6507_gpio_set_value(struct gpio_chip *gc,
spin_unlock_irqrestore(&tca->lock, flags);
if (tca->reg_set)
schedule_work(&tca->work);
+
+ return 0;
}
static int tca6507_gpio_direction_output(struct gpio_chip *gc,
unsigned offset, int val)
{
- tca6507_gpio_set_value(gc, offset, val);
- return 0;
+ return tca6507_gpio_set_value(gc, offset, val);
}
static int tca6507_probe_gpios(struct device *dev,
@@ -636,7 +637,7 @@ static int tca6507_probe_gpios(struct device *dev,
tca->gpio.base = -1;
tca->gpio.owner = THIS_MODULE;
tca->gpio.direction_output = tca6507_gpio_direction_output;
- tca->gpio.set = tca6507_gpio_set_value;
+ tca->gpio.set_rv = tca6507_gpio_set_value;
tca->gpio.parent = dev;
err = devm_gpiochip_add_data(dev, &tca->gpio, tca);
if (err) {
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] leds: use new GPIO setter callbacks
2025-04-23 7:53 [PATCH 0/4] leds: use new GPIO setter callbacks Bartosz Golaszewski
` (3 preceding siblings ...)
2025-04-23 7:53 ` [PATCH 4/4] leds: tca6507: " Bartosz Golaszewski
@ 2025-04-23 9:12 ` Linus Walleij
2025-04-24 16:27 ` Lee Jones
5 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2025-04-23 9:12 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lee Jones, Pavel Machek, Riku Voipio, linux-leds, linux-kernel,
linux-gpio, Bartosz Golaszewski
On Wed, Apr 23, 2025 at 9:54 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> values") added new line setter callbacks to struct gpio_chip. They allow
> to indicate failures to callers. We're in the process of converting all
> GPIO controllers to using them before removing the old ones. This series
> converts all GPIO drivers under drivers/leds/.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The series:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] leds: use new GPIO setter callbacks
2025-04-23 7:53 [PATCH 0/4] leds: use new GPIO setter callbacks Bartosz Golaszewski
` (4 preceding siblings ...)
2025-04-23 9:12 ` [PATCH 0/4] leds: use new GPIO " Linus Walleij
@ 2025-04-24 16:27 ` Lee Jones
5 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2025-04-24 16:27 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Linus Walleij, Riku Voipio,
Bartosz Golaszewski
Cc: linux-leds, linux-kernel, linux-gpio, Bartosz Golaszewski
On Wed, 23 Apr 2025 09:53:49 +0200, Bartosz Golaszewski wrote:
> Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> values") added new line setter callbacks to struct gpio_chip. They allow
> to indicate failures to callers. We're in the process of converting all
> GPIO controllers to using them before removing the old ones. This series
> converts all GPIO drivers under drivers/leds/.
>
>
> [...]
Applied, thanks!
[1/4] leds: lgm-sso: use new line value setter callbacks
commit: d48b4a8402c07453f82a95af60702d06c14bca18
[2/4] leds: pca955x: use new line value setter callbacks
commit: f5800749963eefb11001fe961434a1b0fdf12382
[3/4] leds: pca9532: use new line value setter callbacks
commit: e3f286285f19d985323f4e3454894d6f8ba83dbc
[4/4] leds: tca6507: use new line value setter callbacks
commit: df80e14ebe1035004c515b952cb700a391f220f5
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 7+ messages in thread