1 --- a/drivers/net/ag71xx/ag71xx_mdio.c
2 +++ b/drivers/net/ag71xx/ag71xx_mdio.c
3 @@ -57,7 +57,7 @@ static int ag71xx_mdio_mii_read(struct a
4 while (ag71xx_mdio_rr(am, AG71XX_REG_MII_IND) & MII_IND_BUSY) {
6 printk(KERN_ERR "%s: mii_read timed out\n",
12 @@ -88,7 +88,7 @@ static void ag71xx_mdio_mii_write(struct
13 while (ag71xx_mdio_rr(am, AG71XX_REG_MII_IND) & MII_IND_BUSY) {
15 printk(KERN_ERR "%s: mii_write timed out\n",
20 udelay(AG71XX_MDIO_DELAY);
21 @@ -154,23 +154,27 @@ static int __init ag71xx_mdio_probe(stru
25 - am->mii_bus.name = "ag71xx_mdio";
26 - am->mii_bus.read = ag71xx_mdio_read;
27 - am->mii_bus.write = ag71xx_mdio_write;
28 - am->mii_bus.reset = ag71xx_mdio_reset;
29 - am->mii_bus.irq = am->mii_irq;
30 - am->mii_bus.priv = am;
31 - am->mii_bus.parent = &pdev->dev;
32 - snprintf(am->mii_bus.id, MII_BUS_ID_SIZE, "%x", 0);
33 + am->mii_bus = mdiobus_alloc();
34 + if (am->mii_bus == NULL)
37 + am->mii_bus->name = "ag71xx_mdio";
38 + am->mii_bus->read = ag71xx_mdio_read;
39 + am->mii_bus->write = ag71xx_mdio_write;
40 + am->mii_bus->reset = ag71xx_mdio_reset;
41 + am->mii_bus->irq = am->mii_irq;
42 + am->mii_bus->priv = am;
43 + am->mii_bus->parent = &pdev->dev;
44 + snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0);
46 pdata = pdev->dev.platform_data;
48 - am->mii_bus.phy_mask = pdata->phy_mask;
49 + am->mii_bus->phy_mask = pdata->phy_mask;
51 for (i = 0; i < PHY_MAX_ADDR; i++)
52 am->mii_irq[i] = PHY_POLL;
54 - err = mdiobus_register(&am->mii_bus);
55 + err = mdiobus_register(am->mii_bus);
59 @@ -194,7 +198,8 @@ static int __exit ag71xx_mdio_remove(str
62 ag71xx_mdio_bus = NULL;
63 - mdiobus_unregister(&am->mii_bus);
64 + mdiobus_unregister(am->mii_bus);
65 + mdiobus_free(am->mii_bus);
66 iounmap(am->mdio_base);
68 platform_set_drvdata(pdev, NULL);
69 --- a/drivers/net/ag71xx/ag71xx.h
70 +++ b/drivers/net/ag71xx/ag71xx.h
71 @@ -102,7 +102,7 @@ struct ag71xx_ring {
75 - struct mii_bus mii_bus;
76 + struct mii_bus *mii_bus;
77 int mii_irq[PHY_MAX_ADDR];
78 void __iomem *mdio_base;
80 --- a/drivers/net/ag71xx/ag71xx_main.c
81 +++ b/drivers/net/ag71xx/ag71xx_main.c
82 @@ -797,7 +797,7 @@ static int __init ag71xx_probe(struct pl
83 ag = netdev_priv(dev);
86 - ag->mii_bus = &ag71xx_mdio_bus->mii_bus;
87 + ag->mii_bus = ag71xx_mdio_bus->mii_bus;
88 ag->msg_enable = netif_msg_init(ag71xx_debug,
89 AG71XX_DEFAULT_MSG_ENABLE);
90 spin_lock_init(&ag->lock);