aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bfin_mac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bfin_mac.c')
-rw-r--r--drivers/net/bfin_mac.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index df896e23e2c5..a0d41c5d97d8 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -398,7 +398,7 @@ static int mii_probe(struct net_device *dev)
398 398
399 /* search for connect PHY device */ 399 /* search for connect PHY device */
400 for (i = 0; i < PHY_MAX_ADDR; i++) { 400 for (i = 0; i < PHY_MAX_ADDR; i++) {
401 struct phy_device *const tmp_phydev = lp->mii_bus.phy_map[i]; 401 struct phy_device *const tmp_phydev = lp->mii_bus->phy_map[i];
402 402
403 if (!tmp_phydev) 403 if (!tmp_phydev)
404 continue; /* no PHY here... */ 404 continue; /* no PHY here... */
@@ -1058,17 +1058,21 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
1058 setup_mac_addr(ndev->dev_addr); 1058 setup_mac_addr(ndev->dev_addr);
1059 1059
1060 /* MDIO bus initial */ 1060 /* MDIO bus initial */
1061 lp->mii_bus.priv = ndev; 1061 lp->mii_bus = mdiobus_alloc();
1062 lp->mii_bus.read = mdiobus_read; 1062 if (lp->mii_bus == NULL)
1063 lp->mii_bus.write = mdiobus_write; 1063 goto out_err_mdiobus_alloc;
1064 lp->mii_bus.reset = mdiobus_reset; 1064
1065 lp->mii_bus.name = "bfin_mac_mdio"; 1065 lp->mii_bus->priv = ndev;
1066 snprintf(lp->mii_bus.id, MII_BUS_ID_SIZE, "0"); 1066 lp->mii_bus->read = mdiobus_read;
1067 lp->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); 1067 lp->mii_bus->write = mdiobus_write;
1068 lp->mii_bus->reset = mdiobus_reset;
1069 lp->mii_bus->name = "bfin_mac_mdio";
1070 snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "0");
1071 lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
1068 for (i = 0; i < PHY_MAX_ADDR; ++i) 1072 for (i = 0; i < PHY_MAX_ADDR; ++i)
1069 lp->mii_bus.irq[i] = PHY_POLL; 1073 lp->mii_bus->irq[i] = PHY_POLL;
1070 1074
1071 rc = mdiobus_register(&lp->mii_bus); 1075 rc = mdiobus_register(lp->mii_bus);
1072 if (rc) { 1076 if (rc) {
1073 dev_err(&pdev->dev, "Cannot register MDIO bus!\n"); 1077 dev_err(&pdev->dev, "Cannot register MDIO bus!\n");
1074 goto out_err_mdiobus_register; 1078 goto out_err_mdiobus_register;
@@ -1121,8 +1125,10 @@ out_err_reg_ndev:
1121 free_irq(IRQ_MAC_RX, ndev); 1125 free_irq(IRQ_MAC_RX, ndev);
1122out_err_request_irq: 1126out_err_request_irq:
1123out_err_mii_probe: 1127out_err_mii_probe:
1124 mdiobus_unregister(&lp->mii_bus); 1128 mdiobus_unregister(lp->mii_bus);
1125out_err_mdiobus_register: 1129out_err_mdiobus_register:
1130 mdiobus_free(lp->mii_bus);
1131out_err_mdiobus_alloc:
1126 peripheral_free_list(pin_req); 1132 peripheral_free_list(pin_req);
1127out_err_setup_pin_mux: 1133out_err_setup_pin_mux:
1128out_err_probe_mac: 1134out_err_probe_mac:
@@ -1139,7 +1145,8 @@ static int __devexit bfin_mac_remove(struct platform_device *pdev)
1139 1145
1140 platform_set_drvdata(pdev, NULL); 1146 platform_set_drvdata(pdev, NULL);
1141 1147
1142 mdiobus_unregister(&lp->mii_bus); 1148 mdiobus_unregister(lp->mii_bus);
1149 mdiobus_free(lp->mii_bus);
1143 1150
1144 unregister_netdev(ndev); 1151 unregister_netdev(ndev);
1145 1152