1 --- a/drivers/net/ag71xx/ag71xx_mdio.c
2 +++ b/drivers/net/ag71xx/ag71xx_mdio.c
3 @@ -32,12 +32,12 @@ static inline u32 ag71xx_mdio_rr(struct
4 static void ag71xx_mdio_dump_regs(struct ag71xx_mdio *am)
6 DBG("%s: mii_cfg=%08x, mii_cmd=%08x, mii_addr=%08x\n",
9 ag71xx_mdio_rr(am, AG71XX_REG_MII_CFG),
10 ag71xx_mdio_rr(am, AG71XX_REG_MII_CMD),
11 ag71xx_mdio_rr(am, AG71XX_REG_MII_ADDR));
12 DBG("%s: mii_ctrl=%08x, mii_status=%08x, mii_ind=%08x\n",
15 ag71xx_mdio_rr(am, AG71XX_REG_MII_CTRL),
16 ag71xx_mdio_rr(am, AG71XX_REG_MII_STATUS),
17 ag71xx_mdio_rr(am, AG71XX_REG_MII_IND));
18 @@ -57,7 +57,7 @@ static int ag71xx_mdio_mii_read(struct a
19 while (ag71xx_mdio_rr(am, AG71XX_REG_MII_IND) & MII_IND_BUSY) {
21 printk(KERN_ERR "%s: mii_read timed out\n",
27 @@ -88,7 +88,7 @@ static void ag71xx_mdio_mii_write(struct
28 while (ag71xx_mdio_rr(am, AG71XX_REG_MII_IND) & MII_IND_BUSY) {
30 printk(KERN_ERR "%s: mii_write timed out\n",
35 udelay(AG71XX_MDIO_DELAY);
36 @@ -154,27 +154,33 @@ static int __init ag71xx_mdio_probe(stru
40 - am->mii_bus.name = "ag71xx_mdio";
41 - am->mii_bus.read = ag71xx_mdio_read;
42 - am->mii_bus.write = ag71xx_mdio_write;
43 - am->mii_bus.reset = ag71xx_mdio_reset;
44 - am->mii_bus.irq = am->mii_irq;
45 - am->mii_bus.priv = am;
46 - am->mii_bus.parent = &pdev->dev;
47 - snprintf(am->mii_bus.id, MII_BUS_ID_SIZE, "%x", 0);
48 + am->mii_bus = mdiobus_alloc();
49 + if (am->mii_bus == NULL) {
54 + am->mii_bus->name = "ag71xx_mdio";
55 + am->mii_bus->read = ag71xx_mdio_read;
56 + am->mii_bus->write = ag71xx_mdio_write;
57 + am->mii_bus->reset = ag71xx_mdio_reset;
58 + am->mii_bus->irq = am->mii_irq;
59 + am->mii_bus->priv = am;
60 + am->mii_bus->parent = &pdev->dev;
61 + snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0);
63 pdata = pdev->dev.platform_data;
65 - am->mii_bus.phy_mask = pdata->phy_mask;
66 + am->mii_bus->phy_mask = pdata->phy_mask;
68 for (i = 0; i < PHY_MAX_ADDR; i++)
69 am->mii_irq[i] = PHY_POLL;
71 ag71xx_mdio_wr(am, AG71XX_REG_MAC_CFG1, 0);
73 - err = mdiobus_register(&am->mii_bus);
74 + err = mdiobus_register(am->mii_bus);
79 ag71xx_mdio_dump_regs(am);
81 @@ -182,6 +188,8 @@ static int __init ag71xx_mdio_probe(stru
86 + mdiobus_free(am->mii_bus);
88 iounmap(am->mdio_base);
90 @@ -196,7 +204,8 @@ static int __exit ag71xx_mdio_remove(str
93 ag71xx_mdio_bus = NULL;
94 - mdiobus_unregister(&am->mii_bus);
95 + mdiobus_unregister(am->mii_bus);
96 + mdiobus_free(am->mii_bus);
97 iounmap(am->mdio_base);
99 platform_set_drvdata(pdev, NULL);
100 --- a/drivers/net/ag71xx/ag71xx.h
101 +++ b/drivers/net/ag71xx/ag71xx.h
102 @@ -102,7 +102,7 @@ struct ag71xx_ring {
106 - struct mii_bus mii_bus;
107 + struct mii_bus *mii_bus;
108 int mii_irq[PHY_MAX_ADDR];
109 void __iomem *mdio_base;
111 --- a/drivers/net/ag71xx/ag71xx_main.c
112 +++ b/drivers/net/ag71xx/ag71xx_main.c
113 @@ -797,7 +797,7 @@ static int __init ag71xx_probe(struct pl
114 ag = netdev_priv(dev);
117 - ag->mii_bus = &ag71xx_mdio_bus->mii_bus;
118 + ag->mii_bus = ag71xx_mdio_bus->mii_bus;
119 ag->msg_enable = netif_msg_init(ag71xx_debug,
120 AG71XX_DEFAULT_MSG_ENABLE);
121 spin_lock_init(&ag->lock);