diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-30 10:57:22 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-30 10:57:22 +0300 |
commit | 1b62d134d3c5f9e67de096af7ea3e9fe48966f17 (patch) | |
tree | be30467e997cc8ba0d350309dd498f00cb69969b /drivers/of/of_mdio.c | |
parent | 7a37052adb5e843bcfff6c98aee9b60bb087b910 (diff) | |
parent | e9ca038a94f5a41c0689c5f441fd9c5a567e6f39 (diff) | |
download | linux-1b62d134d3c5f9e67de096af7ea3e9fe48966f17.tar.xz |
Merge back earlier ACPICA changes for v4.11.
Diffstat (limited to 'drivers/of/of_mdio.c')
-rw-r--r-- | drivers/of/of_mdio.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index b470f7e3521d..262281bd68fa 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -292,6 +292,7 @@ struct phy_device *of_phy_find_device(struct device_node *phy_np) mdiodev = to_mdio_device(d); if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) return to_phy_device(d); + put_device(d); } return NULL; @@ -456,8 +457,11 @@ int of_phy_register_fixed_link(struct device_node *np) status.link = 1; status.duplex = of_property_read_bool(fixed_link_node, "full-duplex"); - if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) + if (of_property_read_u32(fixed_link_node, "speed", + &status.speed)) { + of_node_put(fixed_link_node); return -EINVAL; + } status.pause = of_property_read_bool(fixed_link_node, "pause"); status.asym_pause = of_property_read_bool(fixed_link_node, "asym-pause"); @@ -486,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); |