Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethernet: ixp4xx_eth: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Philippe Reynes and committed by
David S. Miller
2a62416d 2c087409

+16 -20
+16 -20
drivers/net/ethernet/xscale/ixp4xx_eth.c
··· 171 171 struct npe *npe; 172 172 struct net_device *netdev; 173 173 struct napi_struct napi; 174 - struct phy_device *phydev; 175 174 struct eth_plat_info *plat; 176 175 buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; 177 176 struct desc *desc_tab; /* coherent */ ··· 561 562 static void ixp4xx_adjust_link(struct net_device *dev) 562 563 { 563 564 struct port *port = netdev_priv(dev); 564 - struct phy_device *phydev = port->phydev; 565 + struct phy_device *phydev = dev->phydev; 565 566 566 567 if (!phydev->link) { 567 568 if (port->speed) { ··· 975 976 976 977 static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd) 977 978 { 978 - struct port *port = netdev_priv(dev); 979 - 980 979 if (!netif_running(dev)) 981 980 return -EINVAL; 982 981 ··· 985 988 return hwtstamp_get(dev, req); 986 989 } 987 990 988 - return phy_mii_ioctl(port->phydev, req, cmd); 991 + return phy_mii_ioctl(dev->phydev, req, cmd); 989 992 } 990 993 991 994 /* ethtool support */ ··· 1004 1007 1005 1008 static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1006 1009 { 1007 - struct port *port = netdev_priv(dev); 1008 - return phy_ethtool_gset(port->phydev, cmd); 1010 + return phy_ethtool_gset(dev->phydev, cmd); 1009 1011 } 1010 1012 1011 1013 static int ixp4xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1012 1014 { 1013 - struct port *port = netdev_priv(dev); 1014 - return phy_ethtool_sset(port->phydev, cmd); 1015 + return phy_ethtool_sset(dev->phydev, cmd); 1015 1016 } 1016 1017 1017 1018 static int ixp4xx_nway_reset(struct net_device *dev) 1018 1019 { 1019 - struct port *port = netdev_priv(dev); 1020 - return phy_start_aneg(port->phydev); 1020 + return phy_start_aneg(dev->phydev); 1021 1021 } 1022 1022 1023 1023 int ixp46x_phc_index = -1; ··· 1253 1259 } 1254 1260 1255 1261 port->speed = 0; /* force "link up" message */ 1256 - phy_start(port->phydev); 1262 + phy_start(dev->phydev); 1257 1263 1258 1264 for (i = 0; i < ETH_ALEN; i++) 1259 1265 __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]); ··· 1374 1380 printk(KERN_CRIT "%s: unable to disable loopback\n", 1375 1381 dev->name); 1376 1382 1377 - phy_stop(port->phydev); 1383 + phy_stop(dev->phydev); 1378 1384 1379 1385 if (!ports_open) 1380 1386 qmgr_disable_irq(TXDONE_QUEUE); ··· 1399 1405 struct port *port; 1400 1406 struct net_device *dev; 1401 1407 struct eth_plat_info *plat = dev_get_platdata(&pdev->dev); 1408 + struct phy_device *phydev = NULL; 1402 1409 u32 regs_phys; 1403 1410 char phy_id[MII_BUS_ID_SIZE + 3]; 1404 1411 int err; ··· 1461 1466 1462 1467 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, 1463 1468 mdio_bus->id, plat->phy); 1464 - port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 1465 - PHY_INTERFACE_MODE_MII); 1466 - if (IS_ERR(port->phydev)) { 1467 - err = PTR_ERR(port->phydev); 1469 + phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 1470 + PHY_INTERFACE_MODE_MII); 1471 + if (IS_ERR(phydev)) { 1472 + err = PTR_ERR(phydev); 1468 1473 goto err_free_mem; 1469 1474 } 1470 1475 1471 - port->phydev->irq = PHY_POLL; 1476 + phydev->irq = PHY_POLL; 1472 1477 1473 1478 if ((err = register_netdev(dev))) 1474 1479 goto err_phy_dis; ··· 1479 1484 return 0; 1480 1485 1481 1486 err_phy_dis: 1482 - phy_disconnect(port->phydev); 1487 + phy_disconnect(phydev); 1483 1488 err_free_mem: 1484 1489 npe_port_tab[NPE_ID(port->id)] = NULL; 1485 1490 release_resource(port->mem_res); ··· 1493 1498 static int eth_remove_one(struct platform_device *pdev) 1494 1499 { 1495 1500 struct net_device *dev = platform_get_drvdata(pdev); 1501 + struct phy_device *phydev = dev->phydev; 1496 1502 struct port *port = netdev_priv(dev); 1497 1503 1498 1504 unregister_netdev(dev); 1499 - phy_disconnect(port->phydev); 1505 + phy_disconnect(phydev); 1500 1506 npe_port_tab[NPE_ID(port->id)] = NULL; 1501 1507 npe_release(port->npe); 1502 1508 release_resource(port->mem_res);