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/phy_device.c | |
parent | d618bf2bfd2a095644c852ebea16f5a981f9d875 (diff) | |
download | lwn-38737e490d4ea91660d3cec83ef88c4e6d360ae4.tar.gz lwn-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/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 97a4f52addac..f761288abe66 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -384,6 +384,24 @@ int phy_device_register(struct phy_device *phydev) EXPORT_SYMBOL(phy_device_register); /** + * phy_device_remove - Remove a previously registered phy device from the MDIO bus + * @phydev: phy_device structure to remove + * + * This doesn't free the phy_device itself, it merely reverses the effects + * of phy_device_register(). Use phy_device_free() to free the device + * after calling this function. + */ +void phy_device_remove(struct phy_device *phydev) +{ + struct mii_bus *bus = phydev->bus; + int addr = phydev->addr; + + device_del(&phydev->dev); + bus->phy_map[addr] = NULL; +} +EXPORT_SYMBOL(phy_device_remove); + +/** * phy_find_first - finds the first PHY device on the bus * @bus: the target MII bus */ |