* [PATCH 01/12] gpio: sama5d2-piobu: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 02/12] gpio: sch311x: " Bartosz Golaszewski
` (11 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-sama5d2-piobu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-sama5d2-piobu.c b/drivers/gpio/gpio-sama5d2-piobu.c
index d770a6f3d846640d8ab4c9ae387635118b82cf51..c31244cf5e89108b5a21ff6ff58569dbef4bf972 100644
--- a/drivers/gpio/gpio-sama5d2-piobu.c
+++ b/drivers/gpio/gpio-sama5d2-piobu.c
@@ -169,15 +169,15 @@ static int sama5d2_piobu_get(struct gpio_chip *chip, unsigned int pin)
/*
* sama5d2_piobu_set() - gpiochip set
*/
-static void sama5d2_piobu_set(struct gpio_chip *chip, unsigned int pin,
- int value)
+static int sama5d2_piobu_set(struct gpio_chip *chip, unsigned int pin,
+ int value)
{
if (!value)
value = PIOBU_LOW;
else
value = PIOBU_HIGH;
- sama5d2_piobu_write_value(chip, pin, PIOBU_SOD, value);
+ return sama5d2_piobu_write_value(chip, pin, PIOBU_SOD, value);
}
static int sama5d2_piobu_probe(struct platform_device *pdev)
@@ -196,7 +196,7 @@ static int sama5d2_piobu_probe(struct platform_device *pdev)
piobu->chip.direction_input = sama5d2_piobu_direction_input;
piobu->chip.direction_output = sama5d2_piobu_direction_output;
piobu->chip.get = sama5d2_piobu_get;
- piobu->chip.set = sama5d2_piobu_set;
+ piobu->chip.set_rv = sama5d2_piobu_set;
piobu->chip.base = -1;
piobu->chip.ngpio = PIOBU_NUM;
piobu->chip.can_sleep = 0;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 02/12] gpio: sch311x: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 01/12] gpio: sama5d2-piobu: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 03/12] gpio: sch: " Bartosz Golaszewski
` (10 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-sch311x.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-sch311x.c b/drivers/gpio/gpio-sch311x.c
index ba4fccf3cc94f108f036936bc2d5006fb4d060a3..44fb5fc21fb8aaa7a4edde5605e3e23c79ab806e 100644
--- a/drivers/gpio/gpio-sch311x.c
+++ b/drivers/gpio/gpio-sch311x.c
@@ -178,14 +178,16 @@ static void __sch311x_gpio_set(struct sch311x_gpio_block *block,
outb(data, block->runtime_reg + block->data_reg);
}
-static void sch311x_gpio_set(struct gpio_chip *chip, unsigned offset,
- int value)
+static int sch311x_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct sch311x_gpio_block *block = gpiochip_get_data(chip);
spin_lock(&block->lock);
__sch311x_gpio_set(block, offset, value);
spin_unlock(&block->lock);
+
+ return 0;
}
static int sch311x_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
@@ -295,7 +297,7 @@ static int sch311x_gpio_probe(struct platform_device *pdev)
block->chip.get_direction = sch311x_gpio_get_direction;
block->chip.set_config = sch311x_gpio_set_config;
block->chip.get = sch311x_gpio_get;
- block->chip.set = sch311x_gpio_set;
+ block->chip.set_rv = sch311x_gpio_set;
block->chip.ngpio = 8;
block->chip.parent = &pdev->dev;
block->chip.base = sch311x_gpio_blocks[i].base;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 03/12] gpio: sch: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 01/12] gpio: sama5d2-piobu: " Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 02/12] gpio: sch311x: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 12:45 ` Andy Shevchenko
2025-06-25 10:33 ` [PATCH 04/12] gpio: siox: " Bartosz Golaszewski
` (9 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-sch.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index ff0341b1222f7ec2ea0df56b004222946d2418c4..833ffdd98d744948cddc32fd8039a9489a654ab4 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -117,7 +117,7 @@ static int sch_gpio_get(struct gpio_chip *gc, unsigned int gpio_num)
return sch_gpio_reg_get(sch, gpio_num, GLV);
}
-static void sch_gpio_set(struct gpio_chip *gc, unsigned int gpio_num, int val)
+static int sch_gpio_set(struct gpio_chip *gc, unsigned int gpio_num, int val)
{
struct sch_gpio *sch = gpiochip_get_data(gc);
unsigned long flags;
@@ -125,6 +125,8 @@ static void sch_gpio_set(struct gpio_chip *gc, unsigned int gpio_num, int val)
spin_lock_irqsave(&sch->lock, flags);
sch_gpio_reg_set(sch, gpio_num, GLV, val);
spin_unlock_irqrestore(&sch->lock, flags);
+
+ return 0;
}
static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned int gpio_num,
@@ -146,8 +148,7 @@ static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned int gpio_num,
* But we cannot prevent a short low pulse if direction is set to high
* and an external pull-up is connected.
*/
- sch_gpio_set(gc, gpio_num, val);
- return 0;
+ return sch_gpio_set(gc, gpio_num, val);
}
static int sch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio_num)
@@ -166,7 +167,7 @@ static const struct gpio_chip sch_gpio_chip = {
.direction_input = sch_gpio_direction_in,
.get = sch_gpio_get,
.direction_output = sch_gpio_direction_out,
- .set = sch_gpio_set,
+ .set_rv = sch_gpio_set,
.get_direction = sch_gpio_get_direction,
};
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 03/12] gpio: sch: use new GPIO line value setter callbacks
2025-06-25 10:33 ` [PATCH 03/12] gpio: sch: " Bartosz Golaszewski
@ 2025-06-25 12:45 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2025-06-25 12:45 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Ludovic Desroches, Linus Walleij, Andy Shevchenko,
Thorsten Scherer, Pengutronix Kernel Team, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
Bartosz Golaszewski
On Wed, Jun 25, 2025 at 12:33:26PM +0200, Bartosz Golaszewski wrote:
> 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.
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 04/12] gpio: siox: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (2 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 03/12] gpio: sch: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-30 5:36 ` Thorsten Scherer
2025-06-25 10:33 ` [PATCH 05/12] gpio: spear-spics: remove unneeded callbacks Bartosz Golaszewski
` (8 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-siox.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-siox.c b/drivers/gpio/gpio-siox.c
index 051bc99bdfb2aa3c8a382f773c5892fed6e0a8b3..95355dda621b40124f4702432565b7381c4e6686 100644
--- a/drivers/gpio/gpio-siox.c
+++ b/drivers/gpio/gpio-siox.c
@@ -160,8 +160,8 @@ static int gpio_siox_get(struct gpio_chip *chip, unsigned int offset)
return ret;
}
-static void gpio_siox_set(struct gpio_chip *chip,
- unsigned int offset, int value)
+static int gpio_siox_set(struct gpio_chip *chip,
+ unsigned int offset, int value)
{
struct gpio_siox_ddata *ddata = gpiochip_get_data(chip);
u8 mask = 1 << (19 - offset);
@@ -174,6 +174,8 @@ static void gpio_siox_set(struct gpio_chip *chip,
ddata->setdata[0] &= ~mask;
mutex_unlock(&ddata->lock);
+
+ return 0;
}
static int gpio_siox_direction_input(struct gpio_chip *chip,
@@ -191,8 +193,7 @@ static int gpio_siox_direction_output(struct gpio_chip *chip,
if (offset < 12)
return -EINVAL;
- gpio_siox_set(chip, offset, value);
- return 0;
+ return gpio_siox_set(chip, offset, value);
}
static int gpio_siox_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -236,7 +237,7 @@ static int gpio_siox_probe(struct siox_device *sdevice)
gc->parent = dev;
gc->owner = THIS_MODULE;
gc->get = gpio_siox_get;
- gc->set = gpio_siox_set;
+ gc->set_rv = gpio_siox_set;
gc->direction_input = gpio_siox_direction_input;
gc->direction_output = gpio_siox_direction_output;
gc->get_direction = gpio_siox_get_direction;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 04/12] gpio: siox: use new GPIO line value setter callbacks
2025-06-25 10:33 ` [PATCH 04/12] gpio: siox: " Bartosz Golaszewski
@ 2025-06-30 5:36 ` Thorsten Scherer
0 siblings, 0 replies; 20+ messages in thread
From: Thorsten Scherer @ 2025-06-30 5:36 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Ludovic Desroches, Linus Walleij, Andy Shevchenko,
Pengutronix Kernel Team, Orson Zhai, Baolin Wang, Chunyan Zhang,
Maxime Coquelin, Alexandre Torgue, linux-arm-kernel, linux-gpio,
linux-kernel, linux-stm32, Bartosz Golaszewski
On Wed, Jun 25, 2025 at 12:33:27PM +0200, Bartosz Golaszewski wrote:
> 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>
Acked-by: Thorsten Scherer <t.scherer@eckelmann.de>
Best regards
Thorsten Scherer
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 05/12] gpio: spear-spics: remove unneeded callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (3 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 04/12] gpio: siox: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 06/12] gpio: spear-spics: use new GPIO line value setter callbacks Bartosz Golaszewski
` (7 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
GPIO core can handle output-only chips that don't implement the get()
and direction_input() callbacks. There's no need to provide dummy
implementations in the driver so drop them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-spear-spics.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
index 51539185400d329c5a065d7a51c27b2ae24f672c..964b7dcb30b7a5bccda964a637f7fec97fe02aa4 100644
--- a/drivers/gpio/gpio-spear-spics.c
+++ b/drivers/gpio/gpio-spear-spics.c
@@ -51,12 +51,6 @@ struct spear_spics {
struct gpio_chip chip;
};
-/* gpio framework specific routines */
-static int spics_get_value(struct gpio_chip *chip, unsigned offset)
-{
- return -ENXIO;
-}
-
static void spics_set_value(struct gpio_chip *chip, unsigned offset, int value)
{
struct spear_spics *spics = gpiochip_get_data(chip);
@@ -76,11 +70,6 @@ static void spics_set_value(struct gpio_chip *chip, unsigned offset, int value)
writel_relaxed(tmp, spics->base + spics->perip_cfg);
}
-static int spics_direction_input(struct gpio_chip *chip, unsigned offset)
-{
- return -ENXIO;
-}
-
static int spics_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
@@ -148,9 +137,7 @@ static int spics_gpio_probe(struct platform_device *pdev)
spics->chip.base = -1;
spics->chip.request = spics_request;
spics->chip.free = spics_free;
- spics->chip.direction_input = spics_direction_input;
spics->chip.direction_output = spics_direction_output;
- spics->chip.get = spics_get_value;
spics->chip.set = spics_set_value;
spics->chip.label = dev_name(&pdev->dev);
spics->chip.parent = &pdev->dev;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 06/12] gpio: spear-spics: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (4 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 05/12] gpio: spear-spics: remove unneeded callbacks Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 07/12] gpio: sprd: " Bartosz Golaszewski
` (6 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-spear-spics.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
index 964b7dcb30b7a5bccda964a637f7fec97fe02aa4..55f0e8afa29143649e868a02edc19d920e10c31c 100644
--- a/drivers/gpio/gpio-spear-spics.c
+++ b/drivers/gpio/gpio-spear-spics.c
@@ -51,7 +51,8 @@ struct spear_spics {
struct gpio_chip chip;
};
-static void spics_set_value(struct gpio_chip *chip, unsigned offset, int value)
+static int spics_set_value(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct spear_spics *spics = gpiochip_get_data(chip);
u32 tmp;
@@ -68,13 +69,14 @@ static void spics_set_value(struct gpio_chip *chip, unsigned offset, int value)
tmp &= ~(0x1 << spics->cs_value_bit);
tmp |= value << spics->cs_value_bit;
writel_relaxed(tmp, spics->base + spics->perip_cfg);
+
+ return 0;
}
static int spics_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
- spics_set_value(chip, offset, value);
- return 0;
+ return spics_set_value(chip, offset, value);
}
static int spics_request(struct gpio_chip *chip, unsigned offset)
@@ -138,7 +140,7 @@ static int spics_gpio_probe(struct platform_device *pdev)
spics->chip.request = spics_request;
spics->chip.free = spics_free;
spics->chip.direction_output = spics_direction_output;
- spics->chip.set = spics_set_value;
+ spics->chip.set_rv = spics_set_value;
spics->chip.label = dev_name(&pdev->dev);
spics->chip.parent = &pdev->dev;
spics->chip.owner = THIS_MODULE;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 07/12] gpio: sprd: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (5 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 06/12] gpio: spear-spics: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-26 1:12 ` Baolin Wang
2025-06-25 10:33 ` [PATCH 08/12] gpio: stmpe: " Bartosz Golaszewski
` (5 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-sprd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-sprd.c b/drivers/gpio/gpio-sprd.c
index c117c11bfb29a84d814706e383faa19afe513e93..bbd5bf51c0882704a9ead35d9fbc7d4b9bceec50 100644
--- a/drivers/gpio/gpio-sprd.c
+++ b/drivers/gpio/gpio-sprd.c
@@ -108,10 +108,12 @@ static int sprd_gpio_get(struct gpio_chip *chip, unsigned int offset)
return sprd_gpio_read(chip, offset, SPRD_GPIO_DATA);
}
-static void sprd_gpio_set(struct gpio_chip *chip, unsigned int offset,
- int value)
+static int sprd_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
sprd_gpio_update(chip, offset, SPRD_GPIO_DATA, value);
+
+ return 0;
}
static void sprd_gpio_irq_mask(struct irq_data *data)
@@ -243,7 +245,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
sprd_gpio->chip.request = sprd_gpio_request;
sprd_gpio->chip.free = sprd_gpio_free;
sprd_gpio->chip.get = sprd_gpio_get;
- sprd_gpio->chip.set = sprd_gpio_set;
+ sprd_gpio->chip.set_rv = sprd_gpio_set;
sprd_gpio->chip.direction_input = sprd_gpio_direction_input;
sprd_gpio->chip.direction_output = sprd_gpio_direction_output;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 07/12] gpio: sprd: use new GPIO line value setter callbacks
2025-06-25 10:33 ` [PATCH 07/12] gpio: sprd: " Bartosz Golaszewski
@ 2025-06-26 1:12 ` Baolin Wang
0 siblings, 0 replies; 20+ messages in thread
From: Baolin Wang @ 2025-06-26 1:12 UTC (permalink / raw)
To: Bartosz Golaszewski, Ludovic Desroches, Linus Walleij,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
Bartosz Golaszewski
On 2025/6/25 18:33, Bartosz Golaszewski wrote:
> 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>
Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 08/12] gpio: stmpe: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (6 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 07/12] gpio: sprd: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-07-03 21:55 ` Linus Walleij
2025-06-25 10:33 ` [PATCH 09/12] gpio: stp-xway: " Bartosz Golaszewski
` (4 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-stmpe.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index dce8ff322e4722f6f97a9850772c7fe7defd9989..0a270156e0bea2f2a6914da6743df6d15b0870f5 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -54,7 +54,7 @@ static int stmpe_gpio_get(struct gpio_chip *chip, unsigned offset)
return !!(ret & mask);
}
-static void stmpe_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
+static int stmpe_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
{
struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(chip);
struct stmpe *stmpe = stmpe_gpio->stmpe;
@@ -67,9 +67,9 @@ static void stmpe_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
* For them we need to write 0 to clear and 1 to set.
*/
if (stmpe->regs[STMPE_IDX_GPSR_LSB] == stmpe->regs[STMPE_IDX_GPCR_LSB])
- stmpe_set_bits(stmpe, reg, mask, val ? mask : 0);
- else
- stmpe_reg_write(stmpe, reg, mask);
+ return stmpe_set_bits(stmpe, reg, mask, val ? mask : 0);
+
+ return stmpe_reg_write(stmpe, reg, mask);
}
static int stmpe_gpio_get_direction(struct gpio_chip *chip,
@@ -98,8 +98,11 @@ static int stmpe_gpio_direction_output(struct gpio_chip *chip,
struct stmpe *stmpe = stmpe_gpio->stmpe;
u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB + (offset / 8)];
u8 mask = BIT(offset % 8);
+ int ret;
- stmpe_gpio_set(chip, offset, val);
+ ret = stmpe_gpio_set(chip, offset, val);
+ if (ret)
+ return ret;
return stmpe_set_bits(stmpe, reg, mask, mask);
}
@@ -133,7 +136,7 @@ static const struct gpio_chip template_chip = {
.direction_input = stmpe_gpio_direction_input,
.get = stmpe_gpio_get,
.direction_output = stmpe_gpio_direction_output,
- .set = stmpe_gpio_set,
+ .set_rv = stmpe_gpio_set,
.request = stmpe_gpio_request,
.can_sleep = true,
};
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 08/12] gpio: stmpe: use new GPIO line value setter callbacks
2025-06-25 10:33 ` [PATCH 08/12] gpio: stmpe: " Bartosz Golaszewski
@ 2025-07-03 21:55 ` Linus Walleij
0 siblings, 0 replies; 20+ messages in thread
From: Linus Walleij @ 2025-07-03 21:55 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Ludovic Desroches, Andy Shevchenko, Thorsten Scherer,
Pengutronix Kernel Team, Orson Zhai, Baolin Wang, Chunyan Zhang,
Maxime Coquelin, Alexandre Torgue, linux-arm-kernel, linux-gpio,
linux-kernel, linux-stm32, Bartosz Golaszewski
On Wed, Jun 25, 2025 at 12:33 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 09/12] gpio: stp-xway: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (7 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 08/12] gpio: stmpe: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 10/12] gpio: syscon: " Bartosz Golaszewski
` (3 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-stp-xway.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 5a6406d1f03aa75e82423f7c5740fdb3df42dd4b..fdda8de6ca366662aec1fccb475f0698fb478ef5 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -113,7 +113,7 @@ static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio)
*
* Set the shadow value and call ltq_ebu_apply.
*/
-static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val)
+static int xway_stp_set(struct gpio_chip *gc, unsigned int gpio, int val)
{
struct xway_stp *chip = gpiochip_get_data(gc);
@@ -124,6 +124,8 @@ static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val)
xway_stp_w32(chip->virt, chip->shadow, XWAY_STP_CPU0);
if (!chip->reserved)
xway_stp_w32_mask(chip->virt, 0, XWAY_STP_CON_SWU, XWAY_STP_CON0);
+
+ return 0;
}
/**
@@ -136,9 +138,7 @@ static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val)
*/
static int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val)
{
- xway_stp_set(gc, gpio, val);
-
- return 0;
+ return xway_stp_set(gc, gpio, val);
}
/**
@@ -249,7 +249,7 @@ static int xway_stp_probe(struct platform_device *pdev)
chip->gc.label = "stp-xway";
chip->gc.direction_output = xway_stp_dir_out;
chip->gc.get = xway_stp_get;
- chip->gc.set = xway_stp_set;
+ chip->gc.set_rv = xway_stp_set;
chip->gc.request = xway_stp_request;
chip->gc.base = -1;
chip->gc.owner = THIS_MODULE;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 10/12] gpio: syscon: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (8 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 09/12] gpio: stp-xway: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 11/12] gpio: tangier: " Bartosz Golaszewski
` (2 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-syscon.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 5ab394ec81e69beae2080a3ca7ecf35868e79abf..f86f78655c2420ef91f1248653b4943b5d8ed1c0 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -40,8 +40,8 @@ struct syscon_gpio_data {
unsigned int bit_count;
unsigned int dat_bit_offset;
unsigned int dir_bit_offset;
- void (*set)(struct gpio_chip *chip,
- unsigned offset, int value);
+ int (*set)(struct gpio_chip *chip, unsigned int offset,
+ int value);
};
struct syscon_gpio_priv {
@@ -68,17 +68,17 @@ static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset)
return !!(val & BIT(offs % SYSCON_REG_BITS));
}
-static void syscon_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
+static int syscon_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
{
struct syscon_gpio_priv *priv = gpiochip_get_data(chip);
unsigned int offs;
offs = priv->dreg_offset + priv->data->dat_bit_offset + offset;
- regmap_update_bits(priv->syscon,
- (offs / SYSCON_REG_BITS) * SYSCON_REG_SIZE,
- BIT(offs % SYSCON_REG_BITS),
- val ? BIT(offs % SYSCON_REG_BITS) : 0);
+ return regmap_update_bits(priv->syscon,
+ (offs / SYSCON_REG_BITS) * SYSCON_REG_SIZE,
+ BIT(offs % SYSCON_REG_BITS),
+ val ? BIT(offs % SYSCON_REG_BITS) : 0);
}
static int syscon_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
@@ -115,9 +115,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val)
BIT(offs % SYSCON_REG_BITS));
}
- chip->set(chip, offset, val);
-
- return 0;
+ return chip->set_rv(chip, offset, val);
}
static const struct syscon_gpio_data clps711x_mctrl_gpio = {
@@ -127,8 +125,8 @@ static const struct syscon_gpio_data clps711x_mctrl_gpio = {
.dat_bit_offset = 0x40 * 8 + 8,
};
-static void rockchip_gpio_set(struct gpio_chip *chip, unsigned int offset,
- int val)
+static int rockchip_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int val)
{
struct syscon_gpio_priv *priv = gpiochip_get_data(chip);
unsigned int offs;
@@ -144,6 +142,8 @@ static void rockchip_gpio_set(struct gpio_chip *chip, unsigned int offset,
data);
if (ret < 0)
dev_err(chip->parent, "gpio write failed ret(%d)\n", ret);
+
+ return ret;
}
static const struct syscon_gpio_data rockchip_rk3328_gpio_mute = {
@@ -156,7 +156,8 @@ static const struct syscon_gpio_data rockchip_rk3328_gpio_mute = {
#define KEYSTONE_LOCK_BIT BIT(0)
-static void keystone_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
+static int keystone_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int val)
{
struct syscon_gpio_priv *priv = gpiochip_get_data(chip);
unsigned int offs;
@@ -165,7 +166,7 @@ static void keystone_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
offs = priv->dreg_offset + priv->data->dat_bit_offset + offset;
if (!val)
- return;
+ return 0;
ret = regmap_update_bits(
priv->syscon,
@@ -174,6 +175,8 @@ static void keystone_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
BIT(offs % SYSCON_REG_BITS) | KEYSTONE_LOCK_BIT);
if (ret < 0)
dev_err(chip->parent, "gpio write failed ret(%d)\n", ret);
+
+ return ret;
}
static const struct syscon_gpio_data keystone_dsp_gpio = {
@@ -248,7 +251,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
if (priv->data->flags & GPIO_SYSCON_FEAT_IN)
priv->chip.direction_input = syscon_gpio_dir_in;
if (priv->data->flags & GPIO_SYSCON_FEAT_OUT) {
- priv->chip.set = priv->data->set ? : syscon_gpio_set;
+ priv->chip.set_rv = priv->data->set ? : syscon_gpio_set;
priv->chip.direction_output = syscon_gpio_dir_out;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 11/12] gpio: tangier: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (9 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 10/12] gpio: syscon: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-06-25 12:45 ` Andy Shevchenko
2025-06-25 10:33 ` [PATCH 12/12] gpio: tc3589x: " Bartosz Golaszewski
2025-07-02 9:10 ` [PATCH 00/12] gpio: " Bartosz Golaszewski
12 siblings, 1 reply; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-tangier.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-tangier.c b/drivers/gpio/gpio-tangier.c
index a415e6d361731e809d137a92b6c4658b447c26bd..ce17b98e0623ea6c0c2146430da38833dfd16cbe 100644
--- a/drivers/gpio/gpio-tangier.c
+++ b/drivers/gpio/gpio-tangier.c
@@ -90,7 +90,7 @@ static int tng_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(readl(gplr) & BIT(shift));
}
-static void tng_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
+static int tng_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct tng_gpio *priv = gpiochip_get_data(chip);
void __iomem *reg;
@@ -101,6 +101,8 @@ static void tng_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
guard(raw_spinlock_irqsave)(&priv->lock);
writel(BIT(shift), reg);
+
+ return 0;
}
static int tng_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
@@ -428,7 +430,7 @@ int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio)
gpio->chip.direction_input = tng_gpio_direction_input;
gpio->chip.direction_output = tng_gpio_direction_output;
gpio->chip.get = tng_gpio_get;
- gpio->chip.set = tng_gpio_set;
+ gpio->chip.set_rv = tng_gpio_set;
gpio->chip.get_direction = tng_gpio_get_direction;
gpio->chip.set_config = tng_gpio_set_config;
gpio->chip.base = info->base;
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 11/12] gpio: tangier: use new GPIO line value setter callbacks
2025-06-25 10:33 ` [PATCH 11/12] gpio: tangier: " Bartosz Golaszewski
@ 2025-06-25 12:45 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2025-06-25 12:45 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Ludovic Desroches, Linus Walleij, Andy Shevchenko,
Thorsten Scherer, Pengutronix Kernel Team, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
Bartosz Golaszewski
On Wed, Jun 25, 2025 at 12:33:34PM +0200, Bartosz Golaszewski wrote:
> 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.
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 12/12] gpio: tc3589x: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (10 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 11/12] gpio: tangier: " Bartosz Golaszewski
@ 2025-06-25 10:33 ` Bartosz Golaszewski
2025-07-03 21:55 ` Linus Walleij
2025-07-02 9:10 ` [PATCH 00/12] gpio: " Bartosz Golaszewski
12 siblings, 1 reply; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-06-25 10:33 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Bartosz Golaszewski,
Andy Shevchenko, Thorsten Scherer, Pengutronix Kernel Team,
Orson Zhai, Baolin Wang, Chunyan Zhang, Maxime Coquelin,
Alexandre Torgue
Cc: linux-arm-kernel, linux-gpio, linux-kernel, linux-stm32,
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/gpio/gpio-tc3589x.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index e62ee7e56908f9125ccb6deb21130a5d9043fbde..0bd32809fd682bac7b16b1f251887abebb44acdc 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -49,7 +49,7 @@ static int tc3589x_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(ret & mask);
}
-static void tc3589x_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
+static int tc3589x_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
{
struct tc3589x_gpio *tc3589x_gpio = gpiochip_get_data(chip);
struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
@@ -57,7 +57,7 @@ static void tc3589x_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
unsigned int pos = offset % 8;
u8 data[] = {val ? BIT(pos) : 0, BIT(pos)};
- tc3589x_block_write(tc3589x, reg, ARRAY_SIZE(data), data);
+ return tc3589x_block_write(tc3589x, reg, ARRAY_SIZE(data), data);
}
static int tc3589x_gpio_direction_output(struct gpio_chip *chip,
@@ -67,8 +67,11 @@ static int tc3589x_gpio_direction_output(struct gpio_chip *chip,
struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
u8 reg = TC3589x_GPIODIR0 + offset / 8;
unsigned int pos = offset % 8;
+ int ret;
- tc3589x_gpio_set(chip, offset, val);
+ ret = tc3589x_gpio_set(chip, offset, val);
+ if (ret)
+ return ret;
return tc3589x_set_bits(tc3589x, reg, BIT(pos), BIT(pos));
}
@@ -146,7 +149,7 @@ static const struct gpio_chip template_chip = {
.label = "tc3589x",
.owner = THIS_MODULE,
.get = tc3589x_gpio_get,
- .set = tc3589x_gpio_set,
+ .set_rv = tc3589x_gpio_set,
.direction_output = tc3589x_gpio_direction_output,
.direction_input = tc3589x_gpio_direction_input,
.get_direction = tc3589x_gpio_get_direction,
--
2.48.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 12/12] gpio: tc3589x: use new GPIO line value setter callbacks
2025-06-25 10:33 ` [PATCH 12/12] gpio: tc3589x: " Bartosz Golaszewski
@ 2025-07-03 21:55 ` Linus Walleij
0 siblings, 0 replies; 20+ messages in thread
From: Linus Walleij @ 2025-07-03 21:55 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Ludovic Desroches, Andy Shevchenko, Thorsten Scherer,
Pengutronix Kernel Team, Orson Zhai, Baolin Wang, Chunyan Zhang,
Maxime Coquelin, Alexandre Torgue, linux-arm-kernel, linux-gpio,
linux-kernel, linux-stm32, Bartosz Golaszewski
On Wed, Jun 25, 2025 at 12:33 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 00/12] gpio: use new GPIO line value setter callbacks
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
` (11 preceding siblings ...)
2025-06-25 10:33 ` [PATCH 12/12] gpio: tc3589x: " Bartosz Golaszewski
@ 2025-07-02 9:10 ` Bartosz Golaszewski
12 siblings, 0 replies; 20+ messages in thread
From: Bartosz Golaszewski @ 2025-07-02 9:10 UTC (permalink / raw)
To: Ludovic Desroches, Linus Walleij, Andy Shevchenko,
Thorsten Scherer, Pengutronix Kernel Team, Orson Zhai,
Baolin Wang, Chunyan Zhang, Maxime Coquelin, Alexandre Torgue,
Bartosz Golaszewski
Cc: Bartosz Golaszewski, linux-arm-kernel, linux-gpio, linux-kernel,
linux-stm32
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Wed, 25 Jun 2025 12:33:23 +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 another round of GPIO drivers.
>
>
> [...]
Applied, thanks!
[01/12] gpio: sama5d2-piobu: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/df213abe6913cae8d1d69efa66b725831f63e663
[02/12] gpio: sch311x: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/e932e894aec6ee22d7314f74e0a27db244a14fdb
[03/12] gpio: sch: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/883c7eb2c4a9e143b2662ba754f9c16fb31adced
[04/12] gpio: siox: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/d5297b0f861a124efe7965619212a632d5138281
[05/12] gpio: spear-spics: remove unneeded callbacks
https://git.kernel.org/brgl/linux/c/e9a5f9ac245fd58b8477f1d2fe5a077803631460
[06/12] gpio: spear-spics: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/70c8f51ff68147176a41d549587a67ea377ed2e2
[07/12] gpio: sprd: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/ae35dd91ad2ea4ae446e74364edd6428a26f5080
[08/12] gpio: stmpe: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/c9148553ac13565ad06d83d7baebef133245ebe6
[09/12] gpio: stp-xway: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/e87dff29ff6b919f64ca25b066c44bbacdc08ac3
[10/12] gpio: syscon: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/c203705c9b46ad0b66ef3bdc93ec9073b00efed1
[11/12] gpio: tangier: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/f3c9b6a51cb31a8816feb801c8c8a2265432143e
[12/12] gpio: tc3589x: use new GPIO line value setter callbacks
https://git.kernel.org/brgl/linux/c/b033bc5a9a7d95b8dc206dd7455a033b0670d8e7
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 20+ messages in thread