linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers
@ 2025-07-15  8:19 Bartosz Golaszewski
  2025-07-15  8:19 ` [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set() Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-07-15  8:19 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Kuppuswamy Sathyanarayanan,
	Andy Shevchenko, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, patches, linux-arm-kernel,
	Bartosz Golaszewski

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 the remaining GPIO drivers.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Changes in v2:
- Drop applied patches from the series
- Use regmap_assign_bits() in gpio-wcove
- Link to v1: https://lore.kernel.org/r/20250709-gpiochip-set-rv-gpio-remaining-v1-0-b8950f69618d@linaro.org

---
Bartosz Golaszewski (2):
      gpio: wcove: use regmap_assign_bits() in .set()
      gpio: wcove: use new GPIO line value setter callbacks

 drivers/gpio/gpio-wcove.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
---
base-commit: 58ba80c4740212c29a1cf9b48f588e60a7612209
change-id: 20250703-gpiochip-set-rv-gpio-remaining-6c554dd3e662

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>



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

* [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set()
  2025-07-15  8:19 [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
@ 2025-07-15  8:19 ` Bartosz Golaszewski
  2025-07-15  8:21   ` Andy Shevchenko
  2025-07-15 13:29   ` Sathyanarayanan Kuppuswamy
  2025-07-15  8:19 ` [PATCH v2 2/2] gpio: wcove: use new GPIO line value setter callbacks Bartosz Golaszewski
  2025-07-16  8:28 ` [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
  2 siblings, 2 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-07-15  8:19 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Kuppuswamy Sathyanarayanan,
	Andy Shevchenko, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, patches, linux-arm-kernel,
	Bartosz Golaszewski

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

Replace the if-else with a direct call to the regmap_assign_bits()
helper and save a couple lines of code.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-wcove.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index 1ec24f6f9300f33f5b3f0f8deb539e08392b8188..816fb8d113e66b27070f286755f3192b2a8f8512 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -208,10 +208,7 @@ static void wcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
 	if (reg < 0)
 		return;
 
-	if (value)
-		regmap_set_bits(wg->regmap, reg, 1);
-	else
-		regmap_clear_bits(wg->regmap, reg, 1);
+	regmap_assign_bits(wg->regmap, reg, 1, value);
 }
 
 static int wcove_gpio_set_config(struct gpio_chip *chip, unsigned int gpio,

-- 
2.48.1



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

* [PATCH v2 2/2] gpio: wcove: use new GPIO line value setter callbacks
  2025-07-15  8:19 [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
  2025-07-15  8:19 ` [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set() Bartosz Golaszewski
@ 2025-07-15  8:19 ` Bartosz Golaszewski
  2025-07-16  8:28 ` [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
  2 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-07-15  8:19 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Kuppuswamy Sathyanarayanan,
	Andy Shevchenko, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, patches, linux-arm-kernel,
	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.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-wcove.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index 816fb8d113e66b27070f286755f3192b2a8f8512..f7df3d5fc71c17fcd1050afdad4187d69dc99012 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -200,15 +200,15 @@ static int wcove_gpio_get(struct gpio_chip *chip, unsigned int gpio)
 	return val & 0x1;
 }
 
-static void wcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
+static int wcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
 {
 	struct wcove_gpio *wg = gpiochip_get_data(chip);
 	int reg = to_reg(gpio, CTRL_OUT);
 
 	if (reg < 0)
-		return;
+		return 0;
 
-	regmap_assign_bits(wg->regmap, reg, 1, value);
+	return regmap_assign_bits(wg->regmap, reg, 1, value);
 }
 
 static int wcove_gpio_set_config(struct gpio_chip *chip, unsigned int gpio,
@@ -439,7 +439,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)
 	wg->chip.direction_output = wcove_gpio_dir_out;
 	wg->chip.get_direction = wcove_gpio_get_direction;
 	wg->chip.get = wcove_gpio_get;
-	wg->chip.set = wcove_gpio_set;
+	wg->chip.set_rv = wcove_gpio_set;
 	wg->chip.set_config = wcove_gpio_set_config;
 	wg->chip.base = -1;
 	wg->chip.ngpio = WCOVE_VGPIO_NUM;

-- 
2.48.1



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

* Re: [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set()
  2025-07-15  8:19 ` [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set() Bartosz Golaszewski
@ 2025-07-15  8:21   ` Andy Shevchenko
  2025-07-15  8:22     ` Andy Shevchenko
  2025-07-15 13:29   ` Sathyanarayanan Kuppuswamy
  1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2025-07-15  8:21 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Kuppuswamy Sathyanarayanan, Andy Shevchenko,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek, linux-gpio,
	linux-kernel, patches, linux-arm-kernel, Bartosz Golaszewski

On Tue, Jul 15, 2025 at 10:19:44AM +0200, Bartosz Golaszewski wrote:
> 
> Replace the if-else with a direct call to the regmap_assign_bits()
> helper and save a couple lines of code.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko




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

* Re: [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set()
  2025-07-15  8:21   ` Andy Shevchenko
@ 2025-07-15  8:22     ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2025-07-15  8:22 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Kuppuswamy Sathyanarayanan, Andy Shevchenko,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek, linux-gpio,
	linux-kernel, patches, linux-arm-kernel, Bartosz Golaszewski

On Tue, Jul 15, 2025 at 11:21:53AM +0300, Andy Shevchenko wrote:
> On Tue, Jul 15, 2025 at 10:19:44AM +0200, Bartosz Golaszewski wrote:

> > Replace the if-else with a direct call to the regmap_assign_bits()
> > helper and save a couple lines of code.

'...a couple of lines of code.'

> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko




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

* Re: [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set()
  2025-07-15  8:19 ` [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set() Bartosz Golaszewski
  2025-07-15  8:21   ` Andy Shevchenko
@ 2025-07-15 13:29   ` Sathyanarayanan Kuppuswamy
  1 sibling, 0 replies; 7+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2025-07-15 13:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, Andy Shevchenko,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, patches, linux-arm-kernel,
	Bartosz Golaszewski


On 7/15/25 1:19 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Replace the if-else with a direct call to the regmap_assign_bits()
> helper and save a couple lines of code.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

>   drivers/gpio/gpio-wcove.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
> index 1ec24f6f9300f33f5b3f0f8deb539e08392b8188..816fb8d113e66b27070f286755f3192b2a8f8512 100644
> --- a/drivers/gpio/gpio-wcove.c
> +++ b/drivers/gpio/gpio-wcove.c
> @@ -208,10 +208,7 @@ static void wcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
>   	if (reg < 0)
>   		return;
>   
> -	if (value)
> -		regmap_set_bits(wg->regmap, reg, 1);
> -	else
> -		regmap_clear_bits(wg->regmap, reg, 1);
> +	regmap_assign_bits(wg->regmap, reg, 1, value);
>   }
>   
>   static int wcove_gpio_set_config(struct gpio_chip *chip, unsigned int gpio,
>
-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer



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

* Re: [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers
  2025-07-15  8:19 [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
  2025-07-15  8:19 ` [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set() Bartosz Golaszewski
  2025-07-15  8:19 ` [PATCH v2 2/2] gpio: wcove: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-07-16  8:28 ` Bartosz Golaszewski
  2 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-07-16  8:28 UTC (permalink / raw)
  To: Linus Walleij, Kuppuswamy Sathyanarayanan, Andy Shevchenko,
	Shubhrajyoti Datta, Srinivas Neeli, Michal Simek,
	Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, patches,
	linux-arm-kernel

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


On Tue, 15 Jul 2025 10:19:43 +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 the remaining GPIO drivers.
> 
> 
> [...]

Applied, thanks!

[1/2] gpio: wcove: use regmap_assign_bits() in .set()
      https://git.kernel.org/brgl/linux/c/03d4bd5729f3adb3dbf923ab08affb5bad262d53
[2/2] gpio: wcove: use new GPIO line value setter callbacks
      https://git.kernel.org/brgl/linux/c/26b6443826d98ac1f5c780788549b8df30e12fa2

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


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

end of thread, other threads:[~2025-07-16  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15  8:19 [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers Bartosz Golaszewski
2025-07-15  8:19 ` [PATCH v2 1/2] gpio: wcove: use regmap_assign_bits() in .set() Bartosz Golaszewski
2025-07-15  8:21   ` Andy Shevchenko
2025-07-15  8:22     ` Andy Shevchenko
2025-07-15 13:29   ` Sathyanarayanan Kuppuswamy
2025-07-15  8:19 ` [PATCH v2 2/2] gpio: wcove: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-16  8:28 ` [PATCH v2 0/2] gpio: use new GPIO line value setter callbacks in remaining drivers 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).