Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mdiobus: release reset_gpio in mdiobus_unregister_device()

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>
Link: https://patch.msgid.link/20250807135449.254254-2-csokas.bence@prolan.hu
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Buday Csaba and committed by
Paolo Abeni
8ea25274 8ee90742

+1 -3
+1
drivers/net/phy/mdio_bus.c
··· 91 91 if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev) 92 92 return -EINVAL; 93 93 94 + gpiod_put(mdiodev->reset_gpio); 94 95 reset_control_put(mdiodev->reset_ctrl); 95 96 96 97 mdiodev->bus->mdio_map[mdiodev->addr] = NULL;
-3
drivers/net/phy/mdio_bus_provider.c
··· 443 443 if (!mdiodev) 444 444 continue; 445 445 446 - if (mdiodev->reset_gpio) 447 - gpiod_put(mdiodev->reset_gpio); 448 - 449 446 mdiodev->device_remove(mdiodev); 450 447 mdiodev->device_free(mdiodev); 451 448 }