net: dsa: realtek: use gpiod_set_value_cansleep for reset GPIO
Subsystems (5)
PATCH 1/1 net: dsa: realtek: use gpiod_set_value_cansleep for reset GPIO
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert() and rtl83xx_reset_deassert() are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander, gpiod_set_value() warns:
WARNING: drivers/gpio/gpiolib.c:4030 at gpiod_set_value+0x44/0x80, CPU#1: kworker/u16:4/61 Hardware name: B&O MAP CA33 Rev f (UNKNOWN) (DT) Workqueue: events_unbound deferred_probe_work_func pc : gpiod_set_value+0x44/0x80 lr : rtl83xx_probe+0x1d8/0x3a0 Call trace: gpiod_set_value+0x44/0x80 (P) rtl83xx_probe+0x1d8/0x3a0 realtek_mdio_probe+0x24/0xa0 mdio_probe+0x38/0x78 really_probe+0xc4/0x3e0 __driver_probe_device+0x15c/0x1b8 driver_probe_device+0xb4/0x120 __device_attach_driver+0xb8/0x1a0 bus_for_each_drv+0x88/0xf0 __device_attach+0xa0/0x1d8 device_initial_probe+0x54/0x68 bus_probe_device+0x38/0xa0 deferred_probe_work_func+0xb8/0x120 process_one_work+0x184/0x4e8 worker_thread+0x188/0x308 kthread+0x130/0x150 ret_from_fork+0x10/0x20
Switch both helpers to gpiod_set_value_cansleep() so such a reset GPIO can be used without triggering the warning.
The reset GPIO has been driven with the non-sleeping gpiod_set_value() since the driver was added in v4.19. The call has since been refactored across several files - from realtek-smi.c / realtek-mdio.c into the common rtl83xx.c module and then into the rtl83xx_reset_assert() and rtl83xx_reset_deassert() helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the same gpiod_set_value_cansleep() conversion at the corresponding open-coded call sites.
--- drivers/net/dsa/realtek/rtl83xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/realtek/rtl83xx.c +2 -2
@@ -334,7 +334,7 @@ void rtl83xx_reset_assert(struct realtek_priv *priv)"Failed to assert the switch reset control: %pe\n" , ERR_PTR(ret)); -gpiod_set_value (priv->reset, true); +gpiod_set_value_cansleep (priv->reset, true); }void rtl83xx_reset_deassert (struct realtek_priv *priv)
@@ -347,7 +347,7 @@ void rtl83xx_reset_deassert(struct realtek_priv *priv)"Failed to deassert the switch reset control: %pe\n" , ERR_PTR(ret)); -gpiod_set_value (priv->reset, false); +gpiod_set_value_cansleep (priv->reset, false); }/**
Signature · 1 line
2.47.3
Quoted 43 lines · Oleksij Rempel
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:WARNING: drivers/gpio/gpiolib.c:4030 at gpiod_set_value+0x44/0x80, CPU#1: kworker/u16:4/61 Hardware name: B&O MAP CA33 Rev f (UNKNOWN) (DT) Workqueue: events_unbound deferred_probe_work_func pc : gpiod_set_value+0x44/0x80 lr : rtl83xx_probe+0x1d8/0x3a0 Call trace: gpiod_set_value+0x44/0x80 (P) rtl83xx_probe+0x1d8/0x3a0 realtek_mdio_probe+0x24/0xa0 mdio_probe+0x38/0x78 really_probe+0xc4/0x3e0 __driver_probe_device+0x15c/0x1b8 driver_probe_device+0xb4/0x120 __device_attach_driver+0xb8/0x1a0 bus_for_each_drv+0x88/0xf0 __device_attach+0xa0/0x1d8 device_initial_probe+0x54/0x68 bus_probe_device+0x38/0xa0 deferred_probe_work_func+0xb8/0x120 process_one_work+0x184/0x4e8 worker_thread+0x188/0x308 kthread+0x130/0x150 ret_from_fork+0x10/0x20Switch both helpers to
gpiod_set_value_cansleep()so such a reset GPIO can be used without triggering the warning.The reset GPIO has been driven with the non-sleeping
gpiod_set_value()since the driver was added in v4.19. The call has since been refactored across several files - fromrealtek-smi.c/realtek-mdio.cinto the commonrtl83xx.cmodule and then into thertl83xx_reset_assert()andrtl83xx_reset_deassert()helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the samegpiod_set_value_cansleep()conversion at the corresponding open-coded call sites.
Quoted 8 lines
Fixes d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")Cc <[email protected]> # 6.9.xSigned-off-by Ahmad Fatoum <[email protected]>Co-developed-by Oleksij Rempel <[email protected]>Signed-off-by Oleksij Rempel <[email protected]>--- drivers/net/dsa/realtek/rtl83xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Andrew Lunn
maintainerQuoted 10 lines · Oleksij Rempel
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:Switch both helpers to
gpiod_set_value_cansleep()so such a reset GPIO can be used without triggering the warning.
Quoted 8 lines
The reset GPIO has been driven with the non-sleeping
gpiod_set_value()since the driver was added in v4.19. The call has since been refactored across several files - fromrealtek-smi.c/realtek-mdio.cinto the commonrtl83xx.cmodule and then into thertl83xx_reset_assert()andrtl83xx_reset_deassert()helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the samegpiod_set_value_cansleep()conversion at the corresponding open-coded call sites.
This is one of those fuzzy cases. It never worked, so this is not a regression. Nobody has needed it up until now. So it probably should be considered a new feature, and merged via net-next.
Andrew
Jakub Kicinski
maintainerQuoted 20 lines · On Fri, 14 Aug 2026 16:09:04 +0200 Andrew Lunn wrote:
Quoted 10 lines · Oleksij Rempel
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:Switch both helpers to
gpiod_set_value_cansleep()so such a reset GPIO can be used without triggering the warning.Quoted 8 lines
The reset GPIO has been driven with the non-sleeping
gpiod_set_value()since the driver was added in v4.19. The call has since been refactored across several files - fromrealtek-smi.c/realtek-mdio.cinto the commonrtl83xx.cmodule and then into thertl83xx_reset_assert()andrtl83xx_reset_deassert()helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the samegpiod_set_value_cansleep()conversion at the corresponding open-coded call sites.
Quoted 3 lines
This is one of those fuzzy cases. It never worked, so this is not a regression. Nobody has needed it up until now. So it probably should be considered a new feature, and merged via net-next.
Sounds like it's a false positive, but it's a WARN, so if it hits on real platforms -- I think it's a real fix?
Quoted 21 lines · Jakub Kicinski
Quoted 20 lines · On Fri, 14 Aug 2026 16:09:04 +0200 Andrew Lunn wrote:
Quoted 18 lines · Oleksij Rempel
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:Switch both helpers to
gpiod_set_value_cansleep()so such a reset GPIO can be used without triggering the warning.The reset GPIO has been driven with the non-sleeping
gpiod_set_value()since the driver was added in v4.19. The call has since been refactored across several files - fromrealtek-smi.c/realtek-mdio.cinto the commonrtl83xx.cmodule and then into thertl83xx_reset_assert()andrtl83xx_reset_deassert()helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the samegpiod_set_value_cansleep()conversion at the corresponding open-coded call sites.
Quoted 6 lines
Quoted 3 lines
This is one of those fuzzy cases. It never worked, so this is not a regression. Nobody has needed it up until now. So it probably should be considered a new feature, and merged via net-next.
Sounds like it's a false positive, but it's a WARN, so if it hits on real platforms -- I think it's a real fix?
We can back port it for related product by our self. Otherwise, the LLM back port bot from Sasha Levin will do it any way, as soon as it is taken. no matter as net or net-next. Flip a coin :)
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 43 lines · Oleksij Rempel
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:WARNING: drivers/gpio/gpiolib.c:4030 at gpiod_set_value+0x44/0x80, CPU#1: kworker/u16:4/61 Hardware name: B&O MAP CA33 Rev f (UNKNOWN) (DT) Workqueue: events_unbound deferred_probe_work_func pc : gpiod_set_value+0x44/0x80 lr : rtl83xx_probe+0x1d8/0x3a0 Call trace: gpiod_set_value+0x44/0x80 (P) rtl83xx_probe+0x1d8/0x3a0 realtek_mdio_probe+0x24/0xa0 mdio_probe+0x38/0x78 really_probe+0xc4/0x3e0 __driver_probe_device+0x15c/0x1b8 driver_probe_device+0xb4/0x120 __device_attach_driver+0xb8/0x1a0 bus_for_each_drv+0x88/0xf0 __device_attach+0xa0/0x1d8 device_initial_probe+0x54/0x68 bus_probe_device+0x38/0xa0 deferred_probe_work_func+0xb8/0x120 process_one_work+0x184/0x4e8 worker_thread+0x188/0x308 kthread+0x130/0x150 ret_from_fork+0x10/0x20Switch both helpers to
gpiod_set_value_cansleep()so such a reset GPIO can be used without triggering the warning.The reset GPIO has been driven with the non-sleeping
gpiod_set_value()since the driver was added in v4.19. The call has since been refactored across several files - fromrealtek-smi.c/realtek-mdio.cinto the commonrtl83xx.cmodule and then into thertl83xx_reset_assert()andrtl83xx_reset_deassert()helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the samegpiod_set_value_cansleep()conversion at the corresponding open-coded call sites.
Quoted 5 lines
Fixes d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")Cc <[email protected]> # 6.9.xSigned-off-by Ahmad Fatoum <[email protected]>Co-developed-by Oleksij Rempel <[email protected]>Signed-off-by Oleksij Rempel <[email protected]>
Yours,
Linus Walleij
Quoted 75 lines
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:WARNING: drivers/gpio/gpiolib.c:4030 at gpiod_set_value+0x44/0x80, CPU#1: kworker/u16:4/61 Hardware name: B&O MAP CA33 Rev f (UNKNOWN) (DT) Workqueue: events_unbound deferred_probe_work_func pc : gpiod_set_value+0x44/0x80 lr : rtl83xx_probe+0x1d8/0x3a0 Call trace: gpiod_set_value+0x44/0x80 (P) rtl83xx_probe+0x1d8/0x3a0 realtek_mdio_probe+0x24/0xa0 mdio_probe+0x38/0x78 really_probe+0xc4/0x3e0 __driver_probe_device+0x15c/0x1b8 driver_probe_device+0xb4/0x120 __device_attach_driver+0xb8/0x1a0 bus_for_each_drv+0x88/0xf0 __device_attach+0xa0/0x1d8 device_initial_probe+0x54/0x68 bus_probe_device+0x38/0xa0 deferred_probe_work_func+0xb8/0x120 process_one_work+0x184/0x4e8 worker_thread+0x188/0x308 kthread+0x130/0x150 ret_from_fork+0x10/0x20Switch both helpers to
gpiod_set_value_cansleep()so such a reset GPIO can be used without triggering the warning.The reset GPIO has been driven with the non-sleeping
gpiod_set_value()since the driver was added in v4.19. The call has since been refactored across several files - fromrealtek-smi.c/realtek-mdio.cinto the commonrtl83xx.cmodule and then into thertl83xx_reset_assert()andrtl83xx_reset_deassert()helpers (both in v6.9). This patch therefore applies as-is only to kernels that carry those helpers (v6.9+); older stable kernels need the samegpiod_set_value_cansleep()conversion at the corresponding open-coded call sites.Fixes d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")Cc <[email protected]> # 6.9.xSigned-off-by Ahmad Fatoum <[email protected]>Co-developed-by Oleksij Rempel <[email protected]>Signed-off-by Oleksij Rempel <[email protected]>--- drivers/net/dsa/realtek/rtl83xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/dsa/realtek/rtl83xx.c +2
-3@@ -334,7 +334,7 @@ void rtl83xx_reset_assert(struct realtek_priv *priv)"Failed to assert the switch reset control: %pe\n" , ERR_PTR(ret)); -gpiod_set_value (priv->reset, true); +gpiod_set_value_cansleep (priv->reset, true); }void rtl83xx_reset_deassert (struct realtek_priv *priv)@@ -347,7 +347,7 @@ void rtl83xx_reset_deassert(struct realtek_priv *priv)"Failed to deassert the switch reset control: %pe\n" , ERR_PTR(ret)); -gpiod_set_value (priv->reset, false); +gpiod_set_value_cansleep (priv->reset, false); }/** --
Quoted 2 lines
2.47.3
Regards,
Luiz
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 14 Aug 2026 13:01:02 +0200 you wrote:
From: Ahmad Fatoum <[email protected]>
rtl83xx_reset_assert()andrtl83xx_reset_deassert()are only called from the probe path, which may sleep and is not timing-critical. When the reset GPIO is provided by a sleeping controller such as an I2C I/O expander,gpiod_set_value()warns:[...]
Here is the summary with links:
- [net,v1,1/1] net: dsa: realtek: use gpiod_set_value_cansleep for reset GPIO
https://git.kernel.org/netdev/net/c/fb58b6a696b3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html