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,23 +154,27 @@ 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)
52 + am->mii_bus->name = "ag71xx_mdio";
53 + am->mii_bus->read = ag71xx_mdio_read;
54 + am->mii_bus->write = ag71xx_mdio_write;
55 + am->mii_bus->reset = ag71xx_mdio_reset;
56 + am->mii_bus->irq = am->mii_irq;
57 + am->mii_bus->priv = am;
58 + am->mii_bus->parent = &pdev->dev;
59 + snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0);
61 pdata = pdev->dev.platform_data;
63 - am->mii_bus.phy_mask = pdata->phy_mask;
64 + am->mii_bus->phy_mask = pdata->phy_mask;
66 for (i = 0; i < PHY_MAX_ADDR; i++)
67 am->mii_irq[i] = PHY_POLL;
69 - err = mdiobus_register(&am->mii_bus);
70 + err = mdiobus_register(am->mii_bus);
74 @@ -194,7 +198,8 @@ static int __exit ag71xx_mdio_remove(str
77 ag71xx_mdio_bus = NULL;
78 - mdiobus_unregister(&am->mii_bus);
79 + mdiobus_unregister(am->mii_bus);
80 + mdiobus_free(am->mii_bus);
81 iounmap(am->mdio_base);
83 platform_set_drvdata(pdev, NULL);
84 --- a/drivers/net/ag71xx/ag71xx.h
85 +++ b/drivers/net/ag71xx/ag71xx.h
86 @@ -102,7 +102,7 @@ struct ag71xx_ring {
90 - struct mii_bus mii_bus;
91 + struct mii_bus *mii_bus;
92 int mii_irq[PHY_MAX_ADDR];
93 void __iomem *mdio_base;
95 --- a/drivers/net/ag71xx/ag71xx_main.c
96 +++ b/drivers/net/ag71xx/ag71xx_main.c
97 @@ -797,7 +797,7 @@ static int __init ag71xx_probe(struct pl
98 ag = netdev_priv(dev);
101 - ag->mii_bus = &ag71xx_mdio_bus->mii_bus;
102 + ag->mii_bus = ag71xx_mdio_bus->mii_bus;
103 ag->msg_enable = netif_msg_init(ag71xx_debug,
104 AG71XX_DEFAULT_MSG_ENABLE);
105 spin_lock_init(&ag->lock);