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

net: ethernet: dnet: 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
phydev 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
958974fd de2fbe7a

+12 -17
+12 -16
drivers/net/ethernet/dnet.c
··· 173 173 static void dnet_handle_link_change(struct net_device *dev) 174 174 { 175 175 struct dnet *bp = netdev_priv(dev); 176 - struct phy_device *phydev = bp->phy_dev; 176 + struct phy_device *phydev = dev->phydev; 177 177 unsigned long flags; 178 178 u32 mode_reg, ctl_reg; 179 179 ··· 295 295 bp->link = 0; 296 296 bp->speed = 0; 297 297 bp->duplex = -1; 298 - bp->phy_dev = phydev; 299 298 300 299 return 0; 301 300 } ··· 628 629 struct dnet *bp = netdev_priv(dev); 629 630 630 631 /* if the phy is not yet register, retry later */ 631 - if (!bp->phy_dev) 632 + if (!dev->phydev) 632 633 return -EAGAIN; 633 634 634 635 napi_enable(&bp->napi); 635 636 dnet_init_hw(bp); 636 637 637 - phy_start_aneg(bp->phy_dev); 638 + phy_start_aneg(dev->phydev); 638 639 639 640 /* schedule a link state check */ 640 - phy_start(bp->phy_dev); 641 + phy_start(dev->phydev); 641 642 642 643 netif_start_queue(dev); 643 644 ··· 651 652 netif_stop_queue(dev); 652 653 napi_disable(&bp->napi); 653 654 654 - if (bp->phy_dev) 655 - phy_stop(bp->phy_dev); 655 + if (dev->phydev) 656 + phy_stop(dev->phydev); 656 657 657 658 dnet_reset_hw(bp); 658 659 netif_carrier_off(dev); ··· 732 733 733 734 static int dnet_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 734 735 { 735 - struct dnet *bp = netdev_priv(dev); 736 - struct phy_device *phydev = bp->phy_dev; 736 + struct phy_device *phydev = dev->phydev; 737 737 738 738 if (!phydev) 739 739 return -ENODEV; ··· 742 744 743 745 static int dnet_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 744 746 { 745 - struct dnet *bp = netdev_priv(dev); 746 - struct phy_device *phydev = bp->phy_dev; 747 + struct phy_device *phydev = dev->phydev; 747 748 748 749 if (!phydev) 749 750 return -ENODEV; ··· 752 755 753 756 static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 754 757 { 755 - struct dnet *bp = netdev_priv(dev); 756 - struct phy_device *phydev = bp->phy_dev; 758 + struct phy_device *phydev = dev->phydev; 757 759 758 760 if (!netif_running(dev)) 759 761 return -EINVAL; ··· 871 875 (bp->capabilities & DNET_HAS_IRQ) ? "" : "no ", 872 876 (bp->capabilities & DNET_HAS_GIGABIT) ? "" : "no ", 873 877 (bp->capabilities & DNET_HAS_DMA) ? "" : "no "); 874 - phydev = bp->phy_dev; 878 + phydev = dev->phydev; 875 879 phy_attached_info(phydev); 876 880 877 881 return 0; ··· 895 899 896 900 if (dev) { 897 901 bp = netdev_priv(dev); 898 - if (bp->phy_dev) 899 - phy_disconnect(bp->phy_dev); 902 + if (dev->phydev) 903 + phy_disconnect(dev->phydev); 900 904 mdiobus_unregister(bp->mii_bus); 901 905 mdiobus_free(bp->mii_bus); 902 906 unregister_netdev(dev);
-1
drivers/net/ethernet/dnet.h
··· 216 216 217 217 /* PHY stuff */ 218 218 struct mii_bus *mii_bus; 219 - struct phy_device *phy_dev; 220 219 unsigned int link; 221 220 unsigned int speed; 222 221 unsigned int duplex;