netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
- err = register_netdev(dev);
- if (err) {
- dev_err(&pdev->dev, "unable to register net device\n");
- goto err_free_desc;
- }
-
- pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n",
- dev->name, dev->base_addr, dev->irq,
- ag71xx_get_phy_if_mode_name(pdata->phy_if_mode));
-
ag71xx_dump_regs(ag);
ag71xx_hw_init(ag);
err = ag71xx_phy_connect(ag);
if (err)
- goto err_unregister_netdev;
+ goto err_free_desc;
err = ag71xx_debugfs_init(ag);
if (err)
platform_set_drvdata(pdev, dev);
+ err = register_netdev(dev);
+ if (err) {
+ dev_err(&pdev->dev, "unable to register net device\n");
+ goto err_phy_disconnect;
+ }
+
+ pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n",
+ dev->name, dev->base_addr, dev->irq,
+ ag71xx_get_phy_if_mode_name(pdata->phy_if_mode));
+
return 0;
err_phy_disconnect:
ag71xx_phy_disconnect(ag);
-err_unregister_netdev:
- unregister_netdev(dev);
err_free_desc:
dma_free_coherent(NULL, sizeof(struct ag71xx_desc), ag->stop_desc,
ag->stop_desc_dma);
static int ag71xx_phy_connect_fixed(struct ag71xx *ag)
{
- struct net_device *dev = ag->dev;
+ struct device *dev = &ag->pdev->dev;
struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
int ret = 0;
case SPEED_1000:
break;
default:
- netdev_err(dev, "invalid speed specified\n");
+ dev_err(dev, "invalid speed specified\n");
ret = -EINVAL;
break;
}
- netdev_dbg(dev, "using fixed link parameters\n");
+ dev_dbg(dev, "using fixed link parameters\n");
ag->duplex = pdata->duplex;
ag->speed = pdata->speed;
static int ag71xx_phy_connect_multi(struct ag71xx *ag)
{
- struct net_device *dev = ag->dev;
+ struct device *dev = &ag->pdev->dev;
struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
struct phy_device *phydev = NULL;
int phy_addr;
continue;
DBG("%s: PHY found at %s, uid=%08x\n",
- dev->name,
+ dev_name(dev),
dev_name(&ag->mii_bus->phy_map[phy_addr]->dev),
ag->mii_bus->phy_map[phy_addr]->phy_id);
}
if (!phydev) {
- netdev_err(dev, "no PHY found with phy_mask=%08x\n",
+ dev_err(dev, "no PHY found with phy_mask=%08x\n",
pdata->phy_mask);
return -ENODEV;
}
- ag->phy_dev = phy_connect(dev, dev_name(&phydev->dev),
+ ag->phy_dev = phy_connect(ag->dev, dev_name(&phydev->dev),
&ag71xx_phy_link_adjust,
pdata->phy_if_mode);
if (IS_ERR(ag->phy_dev)) {
- netdev_err(dev, "could not connect to PHY at %s\n",
+ dev_err(dev, "could not connect to PHY at %s\n",
dev_name(&phydev->dev));
return PTR_ERR(ag->phy_dev);
}
phydev->advertising = phydev->supported;
- netdev_info(dev, "connected to PHY at %s [uid=%08x, driver=%s]\n",
+ dev_info(dev, "connected to PHY at %s [uid=%08x, driver=%s]\n",
dev_name(&phydev->dev), phydev->phy_id, phydev->drv->name);
ag->link = 0;
ag->mii_bus = dev_to_mii_bus(pdata->mii_bus_dev);
if (ag->mii_bus == NULL) {
- netdev_err(ag->dev, "unable to find MII bus on device '%s'\n",
+ dev_err(&ag->pdev->dev, "unable to find MII bus on device '%s'\n",
dev_name(pdata->mii_bus_dev));
return -ENODEV;
}