diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-12-09 07:10:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-10 18:55:24 -0500 |
commit | ed4ba4b5b96742d29225308ccccbdb1810b63064 (patch) | |
tree | 2c28a534d7b7fe4ed58925401d69b14df90323be /drivers/net | |
parent | e596e6e4d578f2639416e620d367a3af34814a40 (diff) |
netdev: Use default implementation of ethtool_ops::get_link where possible
Various drivers are using implementations of ethtool_ops::get_link
that are equivalent to the default ethtool_op_get_link(). Change
them to use that instead.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 16 | ||||
-rw-r--r-- | drivers/net/ibmveth.c | 7 | ||||
-rw-r--r-- | drivers/net/igbvf/ethtool.c | 7 | ||||
-rw-r--r-- | drivers/net/iseries_veth.c | 7 | ||||
-rw-r--r-- | drivers/net/mv643xx_eth.c | 7 | ||||
-rw-r--r-- | drivers/net/pxa168_eth.c | 7 | ||||
-rw-r--r-- | drivers/net/sfc/ethtool.c | 9 | ||||
-rw-r--r-- | drivers/net/sunlance.c | 10 |
8 files changed, 8 insertions, 62 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 8984d165a39b..3612900b3bfe 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -194,20 +194,6 @@ static int e1000_get_settings(struct net_device *netdev, | |||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | static u32 e1000_get_link(struct net_device *netdev) | ||
198 | { | ||
199 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
200 | struct e1000_hw *hw = &adapter->hw; | ||
201 | |||
202 | /* | ||
203 | * Avoid touching hardware registers when possible, otherwise | ||
204 | * link negotiation can get messed up when user-level scripts | ||
205 | * are rapidly polling the driver to see if link is up. | ||
206 | */ | ||
207 | return netif_running(netdev) ? netif_carrier_ok(netdev) : | ||
208 | !!(er32(STATUS) & E1000_STATUS_LU); | ||
209 | } | ||
210 | |||
211 | static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) | 197 | static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) |
212 | { | 198 | { |
213 | struct e1000_mac_info *mac = &adapter->hw.mac; | 199 | struct e1000_mac_info *mac = &adapter->hw.mac; |
@@ -2024,7 +2010,7 @@ static const struct ethtool_ops e1000_ethtool_ops = { | |||
2024 | .get_msglevel = e1000_get_msglevel, | 2010 | .get_msglevel = e1000_get_msglevel, |
2025 | .set_msglevel = e1000_set_msglevel, | 2011 | .set_msglevel = e1000_set_msglevel, |
2026 | .nway_reset = e1000_nway_reset, | 2012 | .nway_reset = e1000_nway_reset, |
2027 | .get_link = e1000_get_link, | 2013 | .get_link = ethtool_op_get_link, |
2028 | .get_eeprom_len = e1000_get_eeprom_len, | 2014 | .get_eeprom_len = e1000_get_eeprom_len, |
2029 | .get_eeprom = e1000_get_eeprom, | 2015 | .get_eeprom = e1000_get_eeprom, |
2030 | .set_eeprom = e1000_set_eeprom, | 2016 | .set_eeprom = e1000_set_eeprom, |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index c454b45ca7ec..5522d459654c 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -729,11 +729,6 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
729 | sizeof(info->version) - 1); | 729 | sizeof(info->version) - 1); |
730 | } | 730 | } |
731 | 731 | ||
732 | static u32 netdev_get_link(struct net_device *dev) | ||
733 | { | ||
734 | return 1; | ||
735 | } | ||
736 | |||
737 | static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data) | 732 | static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data) |
738 | { | 733 | { |
739 | struct ibmveth_adapter *adapter = netdev_priv(dev); | 734 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
@@ -918,7 +913,7 @@ static void ibmveth_get_ethtool_stats(struct net_device *dev, | |||
918 | static const struct ethtool_ops netdev_ethtool_ops = { | 913 | static const struct ethtool_ops netdev_ethtool_ops = { |
919 | .get_drvinfo = netdev_get_drvinfo, | 914 | .get_drvinfo = netdev_get_drvinfo, |
920 | .get_settings = netdev_get_settings, | 915 | .get_settings = netdev_get_settings, |
921 | .get_link = netdev_get_link, | 916 | .get_link = ethtool_op_get_link, |
922 | .set_tx_csum = ibmveth_set_tx_csum, | 917 | .set_tx_csum = ibmveth_set_tx_csum, |
923 | .get_rx_csum = ibmveth_get_rx_csum, | 918 | .get_rx_csum = ibmveth_get_rx_csum, |
924 | .set_rx_csum = ibmveth_set_rx_csum, | 919 | .set_rx_csum = ibmveth_set_rx_csum, |
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c index abb3606928fb..ed6e3d910247 100644 --- a/drivers/net/igbvf/ethtool.c +++ b/drivers/net/igbvf/ethtool.c | |||
@@ -110,11 +110,6 @@ static int igbvf_get_settings(struct net_device *netdev, | |||
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | static u32 igbvf_get_link(struct net_device *netdev) | ||
114 | { | ||
115 | return netif_carrier_ok(netdev); | ||
116 | } | ||
117 | |||
118 | static int igbvf_set_settings(struct net_device *netdev, | 113 | static int igbvf_set_settings(struct net_device *netdev, |
119 | struct ethtool_cmd *ecmd) | 114 | struct ethtool_cmd *ecmd) |
120 | { | 115 | { |
@@ -515,7 +510,7 @@ static const struct ethtool_ops igbvf_ethtool_ops = { | |||
515 | .get_msglevel = igbvf_get_msglevel, | 510 | .get_msglevel = igbvf_get_msglevel, |
516 | .set_msglevel = igbvf_set_msglevel, | 511 | .set_msglevel = igbvf_set_msglevel, |
517 | .nway_reset = igbvf_nway_reset, | 512 | .nway_reset = igbvf_nway_reset, |
518 | .get_link = igbvf_get_link, | 513 | .get_link = ethtool_op_get_link, |
519 | .get_eeprom_len = igbvf_get_eeprom_len, | 514 | .get_eeprom_len = igbvf_get_eeprom_len, |
520 | .get_eeprom = igbvf_get_eeprom, | 515 | .get_eeprom = igbvf_get_eeprom, |
521 | .set_eeprom = igbvf_set_eeprom, | 516 | .set_eeprom = igbvf_set_eeprom, |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 38e15be6d513..63ac531f5996 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -1009,15 +1009,10 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | static u32 veth_get_link(struct net_device *dev) | ||
1013 | { | ||
1014 | return 1; | ||
1015 | } | ||
1016 | |||
1017 | static const struct ethtool_ops ops = { | 1012 | static const struct ethtool_ops ops = { |
1018 | .get_drvinfo = veth_get_drvinfo, | 1013 | .get_drvinfo = veth_get_drvinfo, |
1019 | .get_settings = veth_get_settings, | 1014 | .get_settings = veth_get_settings, |
1020 | .get_link = veth_get_link, | 1015 | .get_link = ethtool_op_get_link, |
1021 | }; | 1016 | }; |
1022 | 1017 | ||
1023 | static const struct net_device_ops veth_netdev_ops = { | 1018 | static const struct net_device_ops veth_netdev_ops = { |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index dd2b6a71c6d7..ce31e74a559b 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1514,11 +1514,6 @@ static int mv643xx_eth_nway_reset(struct net_device *dev) | |||
1514 | return genphy_restart_aneg(mp->phy); | 1514 | return genphy_restart_aneg(mp->phy); |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | static u32 mv643xx_eth_get_link(struct net_device *dev) | ||
1518 | { | ||
1519 | return !!netif_carrier_ok(dev); | ||
1520 | } | ||
1521 | |||
1522 | static int | 1517 | static int |
1523 | mv643xx_eth_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | 1518 | mv643xx_eth_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) |
1524 | { | 1519 | { |
@@ -1658,7 +1653,7 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = { | |||
1658 | .set_settings = mv643xx_eth_set_settings, | 1653 | .set_settings = mv643xx_eth_set_settings, |
1659 | .get_drvinfo = mv643xx_eth_get_drvinfo, | 1654 | .get_drvinfo = mv643xx_eth_get_drvinfo, |
1660 | .nway_reset = mv643xx_eth_nway_reset, | 1655 | .nway_reset = mv643xx_eth_nway_reset, |
1661 | .get_link = mv643xx_eth_get_link, | 1656 | .get_link = ethtool_op_get_link, |
1662 | .get_coalesce = mv643xx_eth_get_coalesce, | 1657 | .get_coalesce = mv643xx_eth_get_coalesce, |
1663 | .set_coalesce = mv643xx_eth_set_coalesce, | 1658 | .set_coalesce = mv643xx_eth_set_coalesce, |
1664 | .get_ringparam = mv643xx_eth_get_ringparam, | 1659 | .get_ringparam = mv643xx_eth_get_ringparam, |
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c index 18c0297743f1..04ed27d0b6be 100644 --- a/drivers/net/pxa168_eth.c +++ b/drivers/net/pxa168_eth.c | |||
@@ -1450,16 +1450,11 @@ static void pxa168_get_drvinfo(struct net_device *dev, | |||
1450 | strncpy(info->bus_info, "N/A", 32); | 1450 | strncpy(info->bus_info, "N/A", 32); |
1451 | } | 1451 | } |
1452 | 1452 | ||
1453 | static u32 pxa168_get_link(struct net_device *dev) | ||
1454 | { | ||
1455 | return !!netif_carrier_ok(dev); | ||
1456 | } | ||
1457 | |||
1458 | static const struct ethtool_ops pxa168_ethtool_ops = { | 1453 | static const struct ethtool_ops pxa168_ethtool_ops = { |
1459 | .get_settings = pxa168_get_settings, | 1454 | .get_settings = pxa168_get_settings, |
1460 | .set_settings = pxa168_set_settings, | 1455 | .set_settings = pxa168_set_settings, |
1461 | .get_drvinfo = pxa168_get_drvinfo, | 1456 | .get_drvinfo = pxa168_get_drvinfo, |
1462 | .get_link = pxa168_get_link, | 1457 | .get_link = ethtool_op_get_link, |
1463 | }; | 1458 | }; |
1464 | 1459 | ||
1465 | static const struct net_device_ops pxa168_eth_netdev_ops = { | 1460 | static const struct net_device_ops pxa168_eth_netdev_ops = { |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 5e50e57b0ae2..0e8bb19ed60d 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -620,13 +620,6 @@ static int efx_ethtool_nway_reset(struct net_device *net_dev) | |||
620 | return mdio45_nway_restart(&efx->mdio); | 620 | return mdio45_nway_restart(&efx->mdio); |
621 | } | 621 | } |
622 | 622 | ||
623 | static u32 efx_ethtool_get_link(struct net_device *net_dev) | ||
624 | { | ||
625 | struct efx_nic *efx = netdev_priv(net_dev); | ||
626 | |||
627 | return efx->link_state.up; | ||
628 | } | ||
629 | |||
630 | static int efx_ethtool_get_coalesce(struct net_device *net_dev, | 623 | static int efx_ethtool_get_coalesce(struct net_device *net_dev, |
631 | struct ethtool_coalesce *coalesce) | 624 | struct ethtool_coalesce *coalesce) |
632 | { | 625 | { |
@@ -1047,7 +1040,7 @@ const struct ethtool_ops efx_ethtool_ops = { | |||
1047 | .get_msglevel = efx_ethtool_get_msglevel, | 1040 | .get_msglevel = efx_ethtool_get_msglevel, |
1048 | .set_msglevel = efx_ethtool_set_msglevel, | 1041 | .set_msglevel = efx_ethtool_set_msglevel, |
1049 | .nway_reset = efx_ethtool_nway_reset, | 1042 | .nway_reset = efx_ethtool_nway_reset, |
1050 | .get_link = efx_ethtool_get_link, | 1043 | .get_link = ethtool_op_get_link, |
1051 | .get_coalesce = efx_ethtool_get_coalesce, | 1044 | .get_coalesce = efx_ethtool_get_coalesce, |
1052 | .set_coalesce = efx_ethtool_set_coalesce, | 1045 | .set_coalesce = efx_ethtool_set_coalesce, |
1053 | .get_ringparam = efx_ethtool_get_ringparam, | 1046 | .get_ringparam = efx_ethtool_get_ringparam, |
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 2cf84e5968b2..767e1e2b210d 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c | |||
@@ -1295,17 +1295,9 @@ static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvin | |||
1295 | strcpy(info->version, "2.02"); | 1295 | strcpy(info->version, "2.02"); |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | static u32 sparc_lance_get_link(struct net_device *dev) | ||
1299 | { | ||
1300 | /* We really do not keep track of this, but this | ||
1301 | * is better than not reporting anything at all. | ||
1302 | */ | ||
1303 | return 1; | ||
1304 | } | ||
1305 | |||
1306 | static const struct ethtool_ops sparc_lance_ethtool_ops = { | 1298 | static const struct ethtool_ops sparc_lance_ethtool_ops = { |
1307 | .get_drvinfo = sparc_lance_get_drvinfo, | 1299 | .get_drvinfo = sparc_lance_get_drvinfo, |
1308 | .get_link = sparc_lance_get_link, | 1300 | .get_link = ethtool_op_get_link, |
1309 | }; | 1301 | }; |
1310 | 1302 | ||
1311 | static const struct net_device_ops sparc_lance_ops = { | 1303 | static const struct net_device_ops sparc_lance_ops = { |