All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple
@ 2025-02-27  8:37 Bartosz Golaszewski
  2025-02-27  8:37 ` [PATCH 2/2] gpiolib: update kerneldocs for value setters Bartosz Golaszewski
  2025-03-03  8:34 ` [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-02-27  8:37 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

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

We now have setter callbacks that allow us to indicate success or
failure using the integer return value. Deprecate the older callbacks so
that no new code is tempted to use them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 include/linux/gpio/driver.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index a2a1b6434321..783897d94be8 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -346,8 +346,8 @@ struct gpio_irq_chip {
  * @get: returns value for signal "offset", 0=low, 1=high, or negative error
  * @get_multiple: reads values for multiple signals defined by "mask" and
  *	stores them in "bits", returns 0 on success or negative error
- * @set: assigns output value for signal "offset"
- * @set_multiple: assigns output values for multiple signals defined by "mask"
+ * @set: **DEPRECATED** - please use set_rv() instead
+ * @set_multiple: **DEPRECATED** - please use set_multiple_rv() instead
  * @set_rv: assigns output value for signal "offset", returns 0 on success or
  *          negative error value
  * @set_multiple_rv: assigns output values for multiple signals defined by
-- 
2.45.2


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

* [PATCH 2/2] gpiolib: update kerneldocs for value setters
  2025-02-27  8:37 [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple Bartosz Golaszewski
@ 2025-02-27  8:37 ` Bartosz Golaszewski
  2025-03-03  8:34 ` [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-02-27  8:37 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

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

Value setters now return int and can indicate failure. Update the
kerneldocs.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpiolib.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d0108cf2ee0b..4671a66f5672 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3764,6 +3764,9 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep,
  *
  * This function can be called from contexts where we cannot sleep, and will
  * complain if the GPIO chip functions potentially sleep.
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
  */
 int gpiod_set_raw_value(struct gpio_desc *desc, int value)
 {
@@ -3782,6 +3785,9 @@ EXPORT_SYMBOL_GPL(gpiod_set_raw_value);
  * This sets the value of a GPIO line backing a descriptor, applying
  * different semantic quirks like active low and open drain/source
  * handling.
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
  */
 static int gpiod_set_value_nocheck(struct gpio_desc *desc, int value)
 {
@@ -3806,6 +3812,9 @@ static int gpiod_set_value_nocheck(struct gpio_desc *desc, int value)
  *
  * This function can be called from contexts where we cannot sleep, and will
  * complain if the GPIO chip functions potentially sleep.
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
  */
 int gpiod_set_value(struct gpio_desc *desc, int value)
 {
@@ -4230,6 +4239,9 @@ EXPORT_SYMBOL_GPL(gpiod_get_array_value_cansleep);
  * regard for its ACTIVE_LOW status.
  *
  * This function is to be called from contexts that can sleep.
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
  */
 int gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value)
 {
@@ -4248,6 +4260,9 @@ EXPORT_SYMBOL_GPL(gpiod_set_raw_value_cansleep);
  * account
  *
  * This function is to be called from contexts that can sleep.
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
  */
 int gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
 {
-- 
2.45.2


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

* Re: [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple
  2025-02-27  8:37 [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple Bartosz Golaszewski
  2025-02-27  8:37 ` [PATCH 2/2] gpiolib: update kerneldocs for value setters Bartosz Golaszewski
@ 2025-03-03  8:34 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-03-03  8:34 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel

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


On Thu, 27 Feb 2025 09:37:47 +0100, Bartosz Golaszewski wrote:
> We now have setter callbacks that allow us to indicate success or
> failure using the integer return value. Deprecate the older callbacks so
> that no new code is tempted to use them.
> 
> 

Applied, thanks!

[1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple
      commit: 6224e7fc1ce75edcd03b56a2e0fd4c1765d5888e
[2/2] gpiolib: update kerneldocs for value setters
      commit: 9778568dede2166c7bd124d473f9ec365f782935

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

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

end of thread, other threads:[~2025-03-03  8:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27  8:37 [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple Bartosz Golaszewski
2025-02-27  8:37 ` [PATCH 2/2] gpiolib: update kerneldocs for value setters Bartosz Golaszewski
2025-03-03  8:34 ` [PATCH 1/2] gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.