diff options
author | Grygorii Strashko <grygorii.strashko@ti.com> | 2014-04-30 08:23:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-02 16:16:26 -0400 |
commit | 6d48f44b7b2af67b33c1ae5994b8f642685c8bc8 (patch) | |
tree | 3c39a984abea3ca8016660b111783874d982f5b4 /include/linux/phy.h | |
parent | ca8b6e04bc38891cbc0f2c7855bc7d0498dfff9b (diff) |
mdio_bus: implement devm_mdiobus_alloc/devm_mdiobus_free
Add a resource managed devm_mdiobus_alloc[_size]()/devm_mdiobus_free()
to automatically clean up MDIO bus alocations made by MDIO drivers,
thus leading to simplified MDIO drivers code.
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r-- | include/linux/phy.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index 51d15f684e7e..864ddafad8cc 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -198,6 +198,13 @@ static inline struct mii_bus *mdiobus_alloc(void) | |||
198 | int mdiobus_register(struct mii_bus *bus); | 198 | int mdiobus_register(struct mii_bus *bus); |
199 | void mdiobus_unregister(struct mii_bus *bus); | 199 | void mdiobus_unregister(struct mii_bus *bus); |
200 | void mdiobus_free(struct mii_bus *bus); | 200 | void mdiobus_free(struct mii_bus *bus); |
201 | struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv); | ||
202 | static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) | ||
203 | { | ||
204 | return devm_mdiobus_alloc_size(dev, 0); | ||
205 | } | ||
206 | |||
207 | void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); | ||
201 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); | 208 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); |
202 | int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); | 209 | int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); |
203 | int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); | 210 | int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); |