PHY: Add the phy_device_release device method.
[cascardo/linux.git] / drivers / net / phy / phy_device.c
index f6e4848..5b9e175 100644 (file)
@@ -44,6 +44,16 @@ static struct phy_driver genphy_driver;
 extern int mdio_bus_init(void);
 extern void mdio_bus_exit(void);
 
+void phy_device_free(struct phy_device *phydev)
+{
+       kfree(phydev);
+}
+
+static void phy_device_release(struct device *dev)
+{
+       phy_device_free(to_phy_device(dev));
+}
+
 struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
 {
        struct phy_device *dev;
@@ -54,6 +64,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
        if (NULL == dev)
                return (struct phy_device*) PTR_ERR((void*)-ENOMEM);
 
+       dev->dev.release = phy_device_release;
+
        dev->speed = 0;
        dev->duplex = -1;
        dev->pause = dev->asym_pause = 0;