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

net: ethernet: broadcom: b44: 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
51f141be 583c139c

+11 -12
+11 -11
drivers/net/ethernet/broadcom/b44.c
··· 1486 1486 b44_enable_ints(bp); 1487 1487 1488 1488 if (bp->flags & B44_FLAG_EXTERNAL_PHY) 1489 - phy_start(bp->phydev); 1489 + phy_start(dev->phydev); 1490 1490 1491 1491 netif_start_queue(dev); 1492 1492 out: ··· 1651 1651 netif_stop_queue(dev); 1652 1652 1653 1653 if (bp->flags & B44_FLAG_EXTERNAL_PHY) 1654 - phy_stop(bp->phydev); 1654 + phy_stop(dev->phydev); 1655 1655 1656 1656 napi_disable(&bp->napi); 1657 1657 ··· 1837 1837 struct b44 *bp = netdev_priv(dev); 1838 1838 1839 1839 if (bp->flags & B44_FLAG_EXTERNAL_PHY) { 1840 - BUG_ON(!bp->phydev); 1841 - return phy_ethtool_gset(bp->phydev, cmd); 1840 + BUG_ON(!dev->phydev); 1841 + return phy_ethtool_gset(dev->phydev, cmd); 1842 1842 } 1843 1843 1844 1844 cmd->supported = (SUPPORTED_Autoneg); ··· 1886 1886 int ret; 1887 1887 1888 1888 if (bp->flags & B44_FLAG_EXTERNAL_PHY) { 1889 - BUG_ON(!bp->phydev); 1889 + BUG_ON(!dev->phydev); 1890 1890 spin_lock_irq(&bp->lock); 1891 1891 if (netif_running(dev)) 1892 1892 b44_setup_phy(bp); 1893 1893 1894 - ret = phy_ethtool_sset(bp->phydev, cmd); 1894 + ret = phy_ethtool_sset(dev->phydev, cmd); 1895 1895 1896 1896 spin_unlock_irq(&bp->lock); 1897 1897 ··· 2137 2137 2138 2138 spin_lock_irq(&bp->lock); 2139 2139 if (bp->flags & B44_FLAG_EXTERNAL_PHY) { 2140 - BUG_ON(!bp->phydev); 2141 - err = phy_mii_ioctl(bp->phydev, ifr, cmd); 2140 + BUG_ON(!dev->phydev); 2141 + err = phy_mii_ioctl(dev->phydev, ifr, cmd); 2142 2142 } else { 2143 2143 err = generic_mii_ioctl(&bp->mii_if, if_mii(ifr), cmd, NULL); 2144 2144 } ··· 2206 2206 static void b44_adjust_link(struct net_device *dev) 2207 2207 { 2208 2208 struct b44 *bp = netdev_priv(dev); 2209 - struct phy_device *phydev = bp->phydev; 2209 + struct phy_device *phydev = dev->phydev; 2210 2210 bool status_changed = 0; 2211 2211 2212 2212 BUG_ON(!phydev); ··· 2303 2303 SUPPORTED_MII); 2304 2304 phydev->advertising = phydev->supported; 2305 2305 2306 - bp->phydev = phydev; 2307 2306 bp->old_link = 0; 2308 2307 bp->phy_addr = phydev->mdio.addr; 2309 2308 ··· 2322 2323 2323 2324 static void b44_unregister_phy_one(struct b44 *bp) 2324 2325 { 2326 + struct net_device *dev = bp->dev; 2325 2327 struct mii_bus *mii_bus = bp->mii_bus; 2326 2328 2327 - phy_disconnect(bp->phydev); 2329 + phy_disconnect(dev->phydev); 2328 2330 mdiobus_unregister(mii_bus); 2329 2331 mdiobus_free(mii_bus); 2330 2332 }
-1
drivers/net/ethernet/broadcom/b44.h
··· 404 404 u32 tx_pending; 405 405 u8 phy_addr; 406 406 u8 force_copybreak; 407 - struct phy_device *phydev; 408 407 struct mii_bus *mii_bus; 409 408 int old_link; 410 409 struct mii_if_info mii_if;