Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74579
b: refs/heads/master
c: 6f4a7f4
h: refs/heads/master
i:
  74577: 45ffb94
  74575: 1700f16
v: v3
  • Loading branch information
Anton Vorontsov authored and Jeff Garzik committed Dec 4, 2007
1 parent 505942a commit e352b06
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f9663aea2a938f9dc60dbfef34b9e7847a69c947
refs/heads/master: 6f4a7f4183bdbd02741dcd8edbd10b8628acc5d5
9 changes: 5 additions & 4 deletions trunk/drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus)

err = device_register(&phydev->dev);

if (err)
if (err) {
printk(KERN_ERR "phy %d failed to register\n",
i);
phy_device_free(phydev);
phydev = NULL;
}
}

bus->phy_map[i] = phydev;
Expand All @@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus)
int i;

for (i = 0; i < PHY_MAX_ADDR; i++) {
if (bus->phy_map[i]) {
if (bus->phy_map[i])
device_unregister(&bus->phy_map[i]->dev);
kfree(bus->phy_map[i]);
}
}
}
EXPORT_SYMBOL(mdiobus_unregister);
Expand Down
12 changes: 12 additions & 0 deletions trunk/drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
int phy_start_interrupts(struct phy_device *phydev);
void phy_print_status(struct phy_device *phydev);
struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
void phy_device_free(struct phy_device *phydev);

extern struct bus_type mdio_bus_type;
#endif /* __PHY_H */

0 comments on commit e352b06

Please sign in to comment.