diff options
author | Johan Hovold <johan@kernel.org> | 2016-11-28 21:24:55 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-30 07:17:02 +0300 |
commit | 3f65047c853a2a5abcd8ac1984af3452b5df4ada (patch) | |
tree | 922554935869406027239cc62a6a904b339c6373 /drivers/of/of_mdio.c | |
parent | 0d8f3c67151faaa80e332c254372dca58fb2a9d4 (diff) | |
download | linux-3f65047c853a2a5abcd8ac1984af3452b5df4ada.tar.xz |
of_mdio: add helper to deregister fixed-link PHYs
Add helper to deregister fixed-link PHYs registered using
of_phy_register_fixed_link().
Convert the two drivers that care to deregister their fixed-link PHYs to
use the new helper, but note that most drivers currently fail to do so.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of/of_mdio.c')
-rw-r--r-- | drivers/of/of_mdio.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 5a3145a02547..262281bd68fa 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -490,3 +490,18 @@ int of_phy_register_fixed_link(struct device_node *np) return -ENODEV; } EXPORT_SYMBOL(of_phy_register_fixed_link); + +void of_phy_deregister_fixed_link(struct device_node *np) +{ + struct phy_device *phydev; + + phydev = of_phy_find_device(np); + if (!phydev) + return; + + fixed_phy_unregister(phydev); + + put_device(&phydev->mdio.dev); /* of_phy_find_device() */ + phy_device_free(phydev); /* fixed_phy_register() */ +} +EXPORT_SYMBOL(of_phy_deregister_fixed_link); |