aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ethoc.c
diff options
context:
space:
mode:
authorPhilippe Reynes <tremyfr@gmail.com>2016-07-15 03:59:11 -0400
committerDavid S. Miller <davem@davemloft.net>2016-07-15 19:41:34 -0400
commit11331fc294da76649a18a79c122efb04835fcad1 (patch)
treeb7fd69e2e679661a1c9529172c827b3868928edc /drivers/net/ethernet/ethoc.c
parent6cf285de0231e53057726aea1fb87ab772765cb7 (diff)
net: ethernet: ethoc: 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> Reviewed-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ethoc.c')
-rw-r--r--drivers/net/ethernet/ethoc.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 4edb98c3c6c7..317168a47e1c 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -192,7 +192,6 @@ MODULE_PARM_DESC(buffer_size, "DMA buffer allocation size");
192 * @napi: NAPI structure 192 * @napi: NAPI structure
193 * @msg_enable: device state flags 193 * @msg_enable: device state flags
194 * @lock: device lock 194 * @lock: device lock
195 * @phy: attached PHY
196 * @mdio: MDIO bus for PHY access 195 * @mdio: MDIO bus for PHY access
197 * @phy_id: address of attached PHY 196 * @phy_id: address of attached PHY
198 */ 197 */
@@ -219,7 +218,6 @@ struct ethoc {
219 218
220 spinlock_t lock; 219 spinlock_t lock;
221 220
222 struct phy_device *phy;
223 struct mii_bus *mdio; 221 struct mii_bus *mdio;
224 struct clk *clk; 222 struct clk *clk;
225 s8 phy_id; 223 s8 phy_id;
@@ -694,7 +692,6 @@ static int ethoc_mdio_probe(struct net_device *dev)
694 return err; 692 return err;
695 } 693 }
696 694
697 priv->phy = phy;
698 phy->advertising &= ~(ADVERTISED_1000baseT_Full | 695 phy->advertising &= ~(ADVERTISED_1000baseT_Full |
699 ADVERTISED_1000baseT_Half); 696 ADVERTISED_1000baseT_Half);
700 phy->supported &= ~(SUPPORTED_1000baseT_Full | 697 phy->supported &= ~(SUPPORTED_1000baseT_Full |
@@ -724,7 +721,7 @@ static int ethoc_open(struct net_device *dev)
724 netif_start_queue(dev); 721 netif_start_queue(dev);
725 } 722 }
726 723
727 phy_start(priv->phy); 724 phy_start(dev->phydev);
728 napi_enable(&priv->napi); 725 napi_enable(&priv->napi);
729 726
730 if (netif_msg_ifup(priv)) { 727 if (netif_msg_ifup(priv)) {
@@ -741,8 +738,8 @@ static int ethoc_stop(struct net_device *dev)
741 738
742 napi_disable(&priv->napi); 739 napi_disable(&priv->napi);
743 740
744 if (priv->phy) 741 if (dev->phydev)
745 phy_stop(priv->phy); 742 phy_stop(dev->phydev);
746 743
747 ethoc_disable_rx_and_tx(priv); 744 ethoc_disable_rx_and_tx(priv);
748 free_irq(dev->irq, dev); 745 free_irq(dev->irq, dev);
@@ -770,7 +767,7 @@ static int ethoc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
770 if (!phy) 767 if (!phy)
771 return -ENODEV; 768 return -ENODEV;
772 } else { 769 } else {
773 phy = priv->phy; 770 phy = dev->phydev;
774 } 771 }
775 772
776 return phy_mii_ioctl(phy, ifr, cmd); 773 return phy_mii_ioctl(phy, ifr, cmd);
@@ -899,8 +896,7 @@ out:
899 896
900static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 897static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
901{ 898{
902 struct ethoc *priv = netdev_priv(dev); 899 struct phy_device *phydev = dev->phydev;
903 struct phy_device *phydev = priv->phy;
904 900
905 if (!phydev) 901 if (!phydev)
906 return -EOPNOTSUPP; 902 return -EOPNOTSUPP;
@@ -910,8 +906,7 @@ static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
910 906
911static int ethoc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 907static int ethoc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
912{ 908{
913 struct ethoc *priv = netdev_priv(dev); 909 struct phy_device *phydev = dev->phydev;
914 struct phy_device *phydev = priv->phy;
915 910
916 if (!phydev) 911 if (!phydev)
917 return -EOPNOTSUPP; 912 return -EOPNOTSUPP;
@@ -1261,8 +1256,7 @@ static int ethoc_remove(struct platform_device *pdev)
1261 1256
1262 if (netdev) { 1257 if (netdev) {
1263 netif_napi_del(&priv->napi); 1258 netif_napi_del(&priv->napi);
1264 phy_disconnect(priv->phy); 1259 phy_disconnect(netdev->phydev);
1265 priv->phy = NULL;
1266 1260
1267 if (priv->mdio) { 1261 if (priv->mdio) {
1268 mdiobus_unregister(priv->mdio); 1262 mdiobus_unregister(priv->mdio);