Skip to contentSkip to conversation

gpio: legacy: Kill gpio_set_value_cansleep()

PATCH Applied Andy Shevchenko 5 participants 11 messages Jul 15 – Oct 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: legacy: Kill gpio_set_value_cansleep()

No more users.

---

As of today must go via MFD tree where last user of this API was converted by the commit 62acd2babc1d ("mfd: si476x: Modernize GPIO handling")

 include/linux/gpio/legacy.h | 10 ----------
 1 file changed, 10 deletions(-)
include/linux/gpio/legacy.h +0 -10
index d4273162ed13..1a6e46bc85a0 100644
@@ -63,10 +63,6 @@ static inline int gpio_get_value_cansleep(unsigned gpio)
 {
 	return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
 }
-static inline void gpio_set_value_cansleep(unsigned gpio, int value)
-{
-	gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value);
-}
 
 static inline int gpio_get_value(unsigned gpio)
 {
@@ -140,12 +136,6 @@ static inline int gpio_get_value_cansleep(unsigned gpio)
 	return 0;
 }
 
-static inline void gpio_set_value_cansleep(unsigned gpio, int value)
-{
-	/* GPIO can never have been requested or set as output */
-	WARN_ON(1);
-}
-
 static inline int gpio_to_irq(unsigned gpio)
 {
 	/* GPIO can never have been requested or set as input */
Signature · 1 line
2.50.1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Removal of `gpio_set_value_cansleep()` breaks the build for `drivers/mfd/si476x-i2c.c`. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Removal of gpio_set_value_cansleep() breaks the build for drivers/mfd/si476x-i2c.c. --

--- Patch [1]: [PATCH v1 1/1] gpio: legacy: Kill gpio_set_value_cansleep() --- commit 0128b6379880c534503058a0dec618848431c9df
Author: Andy Shevchenko <[email protected]>

gpio: legacy: Kill gpio_set_value_cansleep()

This commit removes the legacy gpio_set_value_cansleep() API. The commit message notes that there are no more users and that it must go via the MFD tree.

include/linux/gpio/legacy.h static inline int gpio_get_value_cansleep(unsigned gpio) · line 69

Quoted 12 lines
include/linux/gpio/legacy.h +0 -4
index 557ef635935ea..4001208d5d636 100644
@@ -63,10 +63,6 @@ static inline int gpio_get_value_cansleep(unsigned gpio)
 {
 	return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
 }
-static inline void gpio_set_value_cansleep(unsigned gpio, int value)
-{
-	gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value);
-}

[Severity: Low]
Does removing this function break the build for drivers/mfd/si476x-i2c.c? There appear to be active callers of gpio_set_value_cansleep() that will cause implicit declaration errors when CONFIG_MFD_SI476X_CORE is enabled.

For example, in si476x_core_start() on the success path:

drivers/mfd/si476x-i2c.c:si476x_core_start() {
    ...
	if (gpio_is_valid(core->gpio_reset))
		gpio_set_value_cansleep(core->gpio_reset, 1);
    ...
}

It is also called on the error handling path of si476x_core_start():

drivers/mfd/si476x-i2c.c:si476x_core_start() {
    ...
	if (gpio_is_valid(core->gpio_reset))
		gpio_set_value_cansleep(core->gpio_reset, 0);
    ...
}

And during core stop in si476x_core_stop():

drivers/mfd/si476x-i2c.c:si476x_core_stop() {
    ...
	if (gpio_is_valid(core->gpio_reset))
		gpio_set_value_cansleep(core->gpio_reset, 0);
    ...
}

[ ... ]

Quoted 13 lines
include/linux/gpio/legacy.h +0 -6
@@ -148,12 +144,6 @@ static inline int gpio_get_value_cansleep(unsigned gpio)
 	return 0;
 }
 
-static inline void gpio_set_value_cansleep(unsigned gpio, int value)
-{
-	/* GPIO can never have been requested or set as output */
-	WARN_ON(1);
-}
-
 static inline int gpio_to_irq(unsigned gpio)
 {
 	/* GPIO can never have been requested or set as input */
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
Quoted 2 lines · On Wed, Jul 15, 2026 at 07:41:02PM +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Removal of gpio_set_value_cansleep() breaks the build for drivers/mfd/si476x-i2c.c.

...

Quoted 2 lines

[Severity: Low]
Does removing this function break the build for drivers/mfd/si476x-i2c.c?

Yes, and there is a comment to apply this via MFD tree. Did you read that?

Quoted 2 lines

There appear to be active callers of gpio_set_value_cansleep() that will cause implicit declaration errors when CONFIG_MFD_SI476X_CORE is enabled.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 8 lines · Bartosz Golaszewski
Quoted 1 line · Andy Shevchenko

No more users.

Yes please! Thank you!

[1/1] gpio: legacy: Kill gpio_set_value_cansleep()

      https://git.kernel.org/brgl/c/aa4bc3b7d36d52caf7c3d3214ae4ce96d609e8c5

Not sure, I put in the comment that this should be part of MFD, otherwise the one driver will fail (the conversion change in MFD tree only).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Bartosz Golaszewski
Quoted 1 line · Andy Shevchenko

No more users.

Yes please! Thank you!

[1/1] gpio: legacy: Kill gpio_set_value_cansleep()

      https://git.kernel.org/brgl/c/aa4bc3b7d36d52caf7c3d3214ae4ce96d609e8c5
Quoted 9 lines

Not sure, I put in the comment that this should be part of MFD, otherwise the one driver will fail (the conversion change in MFD tree only).

--
With Best Regards,
Andy Shevchenko

Ah dang it, should have read what's below the commit message. Backed out now.

Bart

#6 lore raw
Quoted 9 lines · Bartosz Golaszewski
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Bartosz Golaszewski
Quoted 1 line · Andy Shevchenko

No more users.

Yes please! Thank you!

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

[1/1] gpio: legacy: Kill gpio_set_value_cansleep()

      https://git.kernel.org/brgl/c/aa4bc3b7d36d52caf7c3d3214ae4ce96d609e8c5

Not sure, I put in the comment that this should be part of MFD, otherwise the one driver will fail (the conversion change in MFD tree only).

Ah dang it, should have read what's below the commit message. Backed out now.

Now it can be applied, can't it?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Bartosz Golaszewski
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Bartosz Golaszewski
Quoted 1 line · Andy Shevchenko

No more users.

Yes please! Thank you!

[1/1] gpio: legacy: Kill gpio_set_value_cansleep()

      https://git.kernel.org/brgl/c/aa4bc3b7d36d52caf7c3d3214ae4ce96d609e8c5
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Not sure, I put in the comment that this should be part of MFD, otherwise the one driver will fail (the conversion change in MFD tree only).

Ah dang it, should have read what's below the commit message. Backed out now.

Now it can be applied, can't it?

Sure seems like it! :)

Bartosz