* [PATCH net v2] net: mdiobus: release reset_gpio in mdiobus_unregister_device()
@ 2025-08-07 13:54 Bence Csókás
2025-08-12 10:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Bence Csókás @ 2025-08-07 13:54 UTC (permalink / raw)
To: Rob Herring, Geert Uytterhoeven, David S. Miller,
Sergei Shtylyov, netdev, linux-kernel
Cc: Buday Csaba, Andrew Lunn, Csókás Bence,
Heiner Kallweit, Russell King, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
From: Buday Csaba <buday.csaba@prolan.hu>
reset_gpio is claimed in mdiobus_register_device(), but it is not
released in mdiobus_unregister_device(). It is instead only
released when the whole MDIO bus is unregistered.
When a device uses the reset_gpio property, it becomes impossible
to unregister it and register it again, because the GPIO remains
claimed.
This patch resolves that issue.
Fixes: bafbdd527d56 ("phylib: Add device reset GPIO support") # see notes
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Cc: Csókás Bence <csokas.bence@prolan.hu>
[ csokas.bence: Resolve rebase conflict and clarify msg ]
Signed-off-by: Buday Csaba <buday.csaba@prolan.hu>
---
Notes:
Changes in v2:
* Rebase onto net-next (from 6.12)
* Clarify msg after talking with Csaba in person
* Collect Andrew's tag
Link to v1:
https://lore.kernel.org/all/20250709133222.48802-3-buday.csaba@prolan.hu/
Note to stable@:
* for 6.12 and before, the above v1 patch can be used.
drivers/net/phy/mdio_bus.c | 1 +
drivers/net/phy/mdio_bus_provider.c | 3 ---
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index fda2e27c1810..cad6ed3aa10b 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -91,6 +91,7 @@ int mdiobus_unregister_device(struct mdio_device *mdiodev)
if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev)
return -EINVAL;
+ gpiod_put(mdiodev->reset_gpio);
reset_control_put(mdiodev->reset_ctrl);
mdiodev->bus->mdio_map[mdiodev->addr] = NULL;
diff --git a/drivers/net/phy/mdio_bus_provider.c b/drivers/net/phy/mdio_bus_provider.c
index 48dc4bf85125..f43973e73ea3 100644
--- a/drivers/net/phy/mdio_bus_provider.c
+++ b/drivers/net/phy/mdio_bus_provider.c
@@ -443,9 +443,6 @@ void mdiobus_unregister(struct mii_bus *bus)
if (!mdiodev)
continue;
- if (mdiodev->reset_gpio)
- gpiod_put(mdiodev->reset_gpio);
-
mdiodev->device_remove(mdiodev);
mdiodev->device_free(mdiodev);
}
base-commit: d9104cec3e8fe4b458b74709853231385779001f
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net v2] net: mdiobus: release reset_gpio in mdiobus_unregister_device()
2025-08-07 13:54 [PATCH net v2] net: mdiobus: release reset_gpio in mdiobus_unregister_device() Bence Csókás
@ 2025-08-12 10:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-12 10:40 UTC (permalink / raw)
To: =?utf-8?b?Q3PDs2vDoXMgQmVuY2UgPGNzb2thcy5iZW5jZUBwcm9sYW4uaHU+?=
Cc: robh, geert+renesas, davem, sergei.shtylyov, netdev,
linux-kernel, buday.csaba, andrew, hkallweit1, linux, edumazet,
kuba, pabeni
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Thu, 7 Aug 2025 15:54:49 +0200 you wrote:
> From: Buday Csaba <buday.csaba@prolan.hu>
>
> reset_gpio is claimed in mdiobus_register_device(), but it is not
> released in mdiobus_unregister_device(). It is instead only
> released when the whole MDIO bus is unregistered.
> When a device uses the reset_gpio property, it becomes impossible
> to unregister it and register it again, because the GPIO remains
> claimed.
> This patch resolves that issue.
>
> [...]
Here is the summary with links:
- [net,v2] net: mdiobus: release reset_gpio in mdiobus_unregister_device()
https://git.kernel.org/netdev/net/c/8ea25274ebaf
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-12 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 13:54 [PATCH net v2] net: mdiobus: release reset_gpio in mdiobus_unregister_device() Bence Csókás
2025-08-12 10:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®