Skip to content

Commit 8ea2527

Browse files
Buday CsabaPaolo Abeni
authored andcommitted
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: bafbdd5 ("phylib: Add device reset GPIO support") # see notes Reviewed-by: Andrew Lunn <[email protected]> Cc: Csókás Bence <[email protected]> [ csokas.bence: Resolve rebase conflict and clarify msg ] Signed-off-by: Buday Csaba <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 8ee9074 commit 8ea2527

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ int mdiobus_unregister_device(struct mdio_device *mdiodev)
9191
if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev)
9292
return -EINVAL;
9393

94+
gpiod_put(mdiodev->reset_gpio);
9495
reset_control_put(mdiodev->reset_ctrl);
9596

9697
mdiodev->bus->mdio_map[mdiodev->addr] = NULL;

drivers/net/phy/mdio_bus_provider.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,6 @@ void mdiobus_unregister(struct mii_bus *bus)
443443
if (!mdiodev)
444444
continue;
445445

446-
if (mdiodev->reset_gpio)
447-
gpiod_put(mdiodev->reset_gpio);
448-
449446
mdiodev->device_remove(mdiodev);
450447
mdiodev->device_free(mdiodev);
451448
}

0 commit comments

Comments
 (0)