aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2007-12-04 08:17:33 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-04 15:06:33 -0500
commit6f4a7f4183bdbd02741dcd8edbd10b8628acc5d5 (patch)
treeb160036cc645c4658c577a12b99902028a3885df /drivers/net/phy/phy_device.c
parentf9663aea2a938f9dc60dbfef34b9e7847a69c947 (diff)
PHY: Add the phy_device_release device method.
Lately I've got this nice badness on mdio bus removal: Device 'e0103120:06' does not have a release() function, it is broken and must be fixed. ------------[ cut here ]------------ Badness at drivers/base/core.c:107 NIP: c015c1a8 LR: c015c1a8 CTR: c0157488 REGS: c34bdcf0 TRAP: 0700 Not tainted (2.6.23-rc5-g9ebadfbb-dirty) MSR: 00029032 <EE,ME,IR,DR> CR: 24088422 XER: 00000000 ... [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable) [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc [c34bddd0] [c01365f0] kref_put+0x54/0x6c [c34bdde0] [c013543c] kobject_put+0x24/0x34 [c34bddf0] [c015c384] put_device+0x1c/0x2c [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58 ... Though actually there is nothing broken, it just device subsystem core expects another "pattern" of resource managment. This patch implement phy device's release function, thus we're getting rid of this badness. Also small hidden bug fixed, hope none other introduced. ;-) Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Acked-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f6e484812a98..5b9e1751e1b4 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -44,6 +44,16 @@ static struct phy_driver genphy_driver;
44extern int mdio_bus_init(void); 44extern int mdio_bus_init(void);
45extern void mdio_bus_exit(void); 45extern void mdio_bus_exit(void);
46 46
47void phy_device_free(struct phy_device *phydev)
48{
49 kfree(phydev);
50}
51
52static void phy_device_release(struct device *dev)
53{
54 phy_device_free(to_phy_device(dev));
55}
56
47struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) 57struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
48{ 58{
49 struct phy_device *dev; 59 struct phy_device *dev;
@@ -54,6 +64,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
54 if (NULL == dev) 64 if (NULL == dev)
55 return (struct phy_device*) PTR_ERR((void*)-ENOMEM); 65 return (struct phy_device*) PTR_ERR((void*)-ENOMEM);
56 66
67 dev->dev.release = phy_device_release;
68
57 dev->speed = 0; 69 dev->speed = 0;
58 dev->duplex = -1; 70 dev->duplex = -1;
59 dev->pause = dev->asym_pause = 0; 71 dev->pause = dev->asym_pause = 0;