diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-09-24 20:36:28 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-24 23:04:53 -0700 |
commit | 38737e490d4ea91660d3cec83ef88c4e6d360ae4 (patch) | |
tree | a9625f15c9946760d6b98f2637526001814c97df /drivers/net/phy/mdio_bus.c | |
parent | d618bf2bfd2a095644c852ebea16f5a981f9d875 (diff) | |
download | linux-38737e490d4ea91660d3cec83ef88c4e6d360ae4.tar.gz linux-38737e490d4ea91660d3cec83ef88c4e6d360ae4.tar.bz2 linux-38737e490d4ea91660d3cec83ef88c4e6d360ae4.zip |
phy: add phy_device_remove()
Add a phy_device_remove() function to complement phy_device_register(),
which undoes the effects of phy_device_register() by removing the phy
device from visibility, but not freeing it.
This allows these details to be moved out of the mdio bus code into
the phy code where this action belongs.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 992406624b7c..c340e412b38f 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -291,8 +291,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) error: while (--i >= 0) { - if (bus->phy_map[i]) - device_unregister(&bus->phy_map[i]->dev); + struct phy_device *phydev = bus->phy_map[i]; + if (phydev) { + phy_device_remove(phydev); + phy_device_free(phydev); + } } device_del(&bus->dev); return err; @@ -307,9 +310,11 @@ void mdiobus_unregister(struct mii_bus *bus) bus->state = MDIOBUS_UNREGISTERED; for (i = 0; i < PHY_MAX_ADDR; i++) { - if (bus->phy_map[i]) - device_unregister(&bus->phy_map[i]->dev); - bus->phy_map[i] = NULL; + struct phy_device *phydev = bus->phy_map[i]; + if (phydev) { + phy_device_remove(phydev); + phy_device_free(phydev); + } } device_del(&bus->dev); } |