* [PATCH 1/3] mfd: sm501: use new GPIO line value setter callbacks
2025-04-07 7:24 [PATCH 0/3] mfd: convert GPIO chips to using new value setters Bartosz Golaszewski
@ 2025-04-07 7:24 ` Bartosz Golaszewski
2025-04-07 7:24 ` [PATCH 2/3] mfd: tps65010: " Bartosz Golaszewski
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:24 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Bartosz Golaszewski
Cc: 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/mfd/sm501.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 7ee293b09f62..94ad18b52b83 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -915,7 +915,8 @@ static void sm501_gpio_ensure_gpio(struct sm501_gpio_chip *smchip,
}
}
-static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int sm501_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
@@ -939,6 +940,8 @@ static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
sm501_gpio_ensure_gpio(smchip, bit);
spin_unlock_irqrestore(&smgpio->lock, save);
+
+ return 0;
}
static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset)
@@ -1005,7 +1008,7 @@ static const struct gpio_chip gpio_chip_template = {
.ngpio = 32,
.direction_input = sm501_gpio_input,
.direction_output = sm501_gpio_output,
- .set = sm501_gpio_set,
+ .set_rv = sm501_gpio_set,
.get = sm501_gpio_get,
};
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] mfd: tps65010: use new GPIO line value setter callbacks
2025-04-07 7:24 [PATCH 0/3] mfd: convert GPIO chips to using new value setters Bartosz Golaszewski
2025-04-07 7:24 ` [PATCH 1/3] mfd: sm501: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-04-07 7:24 ` Bartosz Golaszewski
2025-04-07 7:24 ` [PATCH 3/3] mfd: ucb1x00: " Bartosz Golaszewski
2025-04-10 10:13 ` [PATCH 0/3] mfd: convert GPIO chips to using new value setters Lee Jones
3 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:24 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Bartosz Golaszewski
Cc: 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/mfd/tps65010.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 00fb12c4f491..5f1d1e061192 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -446,7 +446,7 @@ static irqreturn_t tps65010_irq(int irq, void *_tps)
* offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes)
* offset 6 == vibrator motor driver
*/
-static void
+static int
tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
if (offset < 4)
@@ -455,6 +455,8 @@ tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
tps65010_set_led(offset - 3, value ? ON : OFF);
else
tps65010_set_vib(value);
+
+ return 0;
}
static int
@@ -619,7 +621,7 @@ static int tps65010_probe(struct i2c_client *client)
tps->chip.parent = &client->dev;
tps->chip.owner = THIS_MODULE;
- tps->chip.set = tps65010_gpio_set;
+ tps->chip.set_rv = tps65010_gpio_set;
tps->chip.direction_output = tps65010_output;
/* NOTE: only partial support for inputs; nyet IRQs */
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] mfd: ucb1x00: use new GPIO line value setter callbacks
2025-04-07 7:24 [PATCH 0/3] mfd: convert GPIO chips to using new value setters Bartosz Golaszewski
2025-04-07 7:24 ` [PATCH 1/3] mfd: sm501: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-04-07 7:24 ` [PATCH 2/3] mfd: tps65010: " Bartosz Golaszewski
@ 2025-04-07 7:24 ` Bartosz Golaszewski
2025-04-10 10:13 ` [PATCH 0/3] mfd: convert GPIO chips to using new value setters Lee Jones
3 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:24 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Bartosz Golaszewski
Cc: 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/mfd/ucb1x00-core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index fc4d4c844a81..fd71ba29f6b5 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -104,7 +104,8 @@ unsigned int ucb1x00_io_read(struct ucb1x00 *ucb)
return ucb1x00_reg_read(ucb, UCB_IO_DATA);
}
-static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int ucb1x00_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct ucb1x00 *ucb = gpiochip_get_data(chip);
unsigned long flags;
@@ -119,6 +120,8 @@ static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
ucb1x00_reg_write(ucb, UCB_IO_DATA, ucb->io_out);
ucb1x00_disable(ucb);
spin_unlock_irqrestore(&ucb->io_lock, flags);
+
+ return 0;
}
static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -567,7 +570,7 @@ static int ucb1x00_probe(struct mcp *mcp)
ucb->gpio.owner = THIS_MODULE;
ucb->gpio.base = pdata->gpio_base;
ucb->gpio.ngpio = 10;
- ucb->gpio.set = ucb1x00_gpio_set;
+ ucb->gpio.set_rv = ucb1x00_gpio_set;
ucb->gpio.get = ucb1x00_gpio_get;
ucb->gpio.direction_input = ucb1x00_gpio_direction_input;
ucb->gpio.direction_output = ucb1x00_gpio_direction_output;
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] mfd: convert GPIO chips to using new value setters
2025-04-07 7:24 [PATCH 0/3] mfd: convert GPIO chips to using new value setters Bartosz Golaszewski
` (2 preceding siblings ...)
2025-04-07 7:24 ` [PATCH 3/3] mfd: ucb1x00: " Bartosz Golaszewski
@ 2025-04-10 10:13 ` Lee Jones
3 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2025-04-10 10:13 UTC (permalink / raw)
To: Lee Jones, Linus Walleij, Bartosz Golaszewski
Cc: linux-kernel, linux-gpio, Bartosz Golaszewski
On Mon, 07 Apr 2025 09:24:12 +0200, Bartosz Golaszewski wrote:
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all MFD GPIO controllers.
>
>
Applied, thanks!
[1/3] mfd: sm501: use new GPIO line value setter callbacks
commit: f66349748885325eaa4abb4f99e0fb8fa36105d4
[2/3] mfd: tps65010: use new GPIO line value setter callbacks
commit: 070502a0056fcebc1d66c39b46ecf7bc530a203f
[3/3] mfd: ucb1x00: use new GPIO line value setter callbacks
commit: 9dcbd9f7238510e272780ac9af82528b4f7b9a87
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 5+ messages in thread