aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Reynes <tremyfr@gmail.com>2016-05-15 19:35:13 -0400
committerDavid S. Miller <davem@davemloft.net>2016-05-16 21:51:41 -0400
commitb3c40adcc9891a709d30b620f0cabd4679a355b5 (patch)
tree5cf8f4f321880ca94c479987336bced000e9a88c
parentcd5f9bb4be950079e911a64972dd7311f0bf8534 (diff)
net: ethernet: ftgmac100: 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>
-rw-r--r--drivers/net/ethernet/faraday/ftgmac100.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 84384e1585a5..9cc23c3fcbf1 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -71,7 +71,6 @@ struct ftgmac100 {
71 struct napi_struct napi; 71 struct napi_struct napi;
72 72
73 struct mii_bus *mii_bus; 73 struct mii_bus *mii_bus;
74 struct phy_device *phydev;
75 int old_speed; 74 int old_speed;
76}; 75};
77 76
@@ -807,7 +806,7 @@ err:
807static void ftgmac100_adjust_link(struct net_device *netdev) 806static void ftgmac100_adjust_link(struct net_device *netdev)
808{ 807{
809 struct ftgmac100 *priv = netdev_priv(netdev); 808 struct ftgmac100 *priv = netdev_priv(netdev);
810 struct phy_device *phydev = priv->phydev; 809 struct phy_device *phydev = netdev->phydev;
811 int ier; 810 int ier;
812 811
813 if (phydev->speed == priv->old_speed) 812 if (phydev->speed == priv->old_speed)
@@ -850,7 +849,6 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv)
850 return PTR_ERR(phydev); 849 return PTR_ERR(phydev);
851 } 850 }
852 851
853 priv->phydev = phydev;
854 return 0; 852 return 0;
855} 853}
856 854
@@ -942,17 +940,13 @@ static void ftgmac100_get_drvinfo(struct net_device *netdev,
942static int ftgmac100_get_settings(struct net_device *netdev, 940static int ftgmac100_get_settings(struct net_device *netdev,
943 struct ethtool_cmd *cmd) 941 struct ethtool_cmd *cmd)
944{ 942{
945 struct ftgmac100 *priv = netdev_priv(netdev); 943 return phy_ethtool_gset(netdev->phydev, cmd);
946
947 return phy_ethtool_gset(priv->phydev, cmd);
948} 944}
949 945
950static int ftgmac100_set_settings(struct net_device *netdev, 946static int ftgmac100_set_settings(struct net_device *netdev,
951 struct ethtool_cmd *cmd) 947 struct ethtool_cmd *cmd)
952{ 948{
953 struct ftgmac100 *priv = netdev_priv(netdev); 949 return phy_ethtool_sset(netdev->phydev, cmd);
954
955 return phy_ethtool_sset(priv->phydev, cmd);
956} 950}
957 951
958static const struct ethtool_ops ftgmac100_ethtool_ops = { 952static const struct ethtool_ops ftgmac100_ethtool_ops = {
@@ -1085,7 +1079,7 @@ static int ftgmac100_open(struct net_device *netdev)
1085 ftgmac100_init_hw(priv); 1079 ftgmac100_init_hw(priv);
1086 ftgmac100_start_hw(priv, 10); 1080 ftgmac100_start_hw(priv, 10);
1087 1081
1088 phy_start(priv->phydev); 1082 phy_start(netdev->phydev);
1089 1083
1090 napi_enable(&priv->napi); 1084 napi_enable(&priv->napi);
1091 netif_start_queue(netdev); 1085 netif_start_queue(netdev);
@@ -1111,7 +1105,7 @@ static int ftgmac100_stop(struct net_device *netdev)
1111 1105
1112 netif_stop_queue(netdev); 1106 netif_stop_queue(netdev);
1113 napi_disable(&priv->napi); 1107 napi_disable(&priv->napi);
1114 phy_stop(priv->phydev); 1108 phy_stop(netdev->phydev);
1115 1109
1116 ftgmac100_stop_hw(priv); 1110 ftgmac100_stop_hw(priv);
1117 free_irq(priv->irq, netdev); 1111 free_irq(priv->irq, netdev);
@@ -1152,9 +1146,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,
1152/* optional */ 1146/* optional */
1153static int ftgmac100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) 1147static int ftgmac100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
1154{ 1148{
1155 struct ftgmac100 *priv = netdev_priv(netdev); 1149 return phy_mii_ioctl(netdev->phydev, ifr, cmd);
1156
1157 return phy_mii_ioctl(priv->phydev, ifr, cmd);
1158} 1150}
1159 1151
1160static const struct net_device_ops ftgmac100_netdev_ops = { 1152static const struct net_device_ops ftgmac100_netdev_ops = {
@@ -1275,7 +1267,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
1275 return 0; 1267 return 0;
1276 1268
1277err_register_netdev: 1269err_register_netdev:
1278 phy_disconnect(priv->phydev); 1270 phy_disconnect(netdev->phydev);
1279err_mii_probe: 1271err_mii_probe:
1280 mdiobus_unregister(priv->mii_bus); 1272 mdiobus_unregister(priv->mii_bus);
1281err_register_mdiobus: 1273err_register_mdiobus:
@@ -1301,7 +1293,7 @@ static int __exit ftgmac100_remove(struct platform_device *pdev)
1301 1293
1302 unregister_netdev(netdev); 1294 unregister_netdev(netdev);
1303 1295
1304 phy_disconnect(priv->phydev); 1296 phy_disconnect(netdev->phydev);
1305 mdiobus_unregister(priv->mii_bus); 1297 mdiobus_unregister(priv->mii_bus);
1306 mdiobus_free(priv->mii_bus); 1298 mdiobus_free(priv->mii_bus);
1307 1299