netdev: Use default implementation of ethtool_ops::get_link where possible
authorBen Hutchings <bhutchings@solarflare.com>
Thu, 9 Dec 2010 12:10:25 +0000 (12:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Dec 2010 23:55:24 +0000 (15:55 -0800)
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>
drivers/net/e1000e/ethtool.c
drivers/net/ibmveth.c
drivers/net/igbvf/ethtool.c
drivers/net/iseries_veth.c
drivers/net/mv643xx_eth.c
drivers/net/pxa168_eth.c
drivers/net/sfc/ethtool.c
drivers/net/sunlance.c

index 8984d165a39b8bab735d718b363c9e7e97f48dd2..3612900b3bfe4ff091952bf7c861862c04d3dd9a 100644 (file)
@@ -194,20 +194,6 @@ static int e1000_get_settings(struct net_device *netdev,
        return 0;
 }
 
-static u32 e1000_get_link(struct net_device *netdev)
-{
-       struct e1000_adapter *adapter = netdev_priv(netdev);
-       struct e1000_hw *hw = &adapter->hw;
-
-       /*
-        * Avoid touching hardware registers when possible, otherwise
-        * link negotiation can get messed up when user-level scripts
-        * are rapidly polling the driver to see if link is up.
-        */
-       return netif_running(netdev) ? netif_carrier_ok(netdev) :
-           !!(er32(STATUS) & E1000_STATUS_LU);
-}
-
 static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
 {
        struct e1000_mac_info *mac = &adapter->hw.mac;
@@ -2024,7 +2010,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
        .get_msglevel           = e1000_get_msglevel,
        .set_msglevel           = e1000_set_msglevel,
        .nway_reset             = e1000_nway_reset,
-       .get_link               = e1000_get_link,
+       .get_link               = ethtool_op_get_link,
        .get_eeprom_len         = e1000_get_eeprom_len,
        .get_eeprom             = e1000_get_eeprom,
        .set_eeprom             = e1000_set_eeprom,
index c454b45ca7ec9caf55cd0f22d0dd7bb2438db381..5522d459654c7a870bf63970ab094e285c040a65 100644 (file)
@@ -729,11 +729,6 @@ static void netdev_get_drvinfo(struct net_device *dev,
                sizeof(info->version) - 1);
 }
 
-static u32 netdev_get_link(struct net_device *dev)
-{
-       return 1;
-}
-
 static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data)
 {
        struct ibmveth_adapter *adapter = netdev_priv(dev);
@@ -918,7 +913,7 @@ static void ibmveth_get_ethtool_stats(struct net_device *dev,
 static const struct ethtool_ops netdev_ethtool_ops = {
        .get_drvinfo            = netdev_get_drvinfo,
        .get_settings           = netdev_get_settings,
-       .get_link               = netdev_get_link,
+       .get_link               = ethtool_op_get_link,
        .set_tx_csum            = ibmveth_set_tx_csum,
        .get_rx_csum            = ibmveth_get_rx_csum,
        .set_rx_csum            = ibmveth_set_rx_csum,
index abb3606928fb131c4878f1369824bf1f03b65ae8..ed6e3d910247fb423f65a98063d24b48bad9f1b4 100644 (file)
@@ -110,11 +110,6 @@ static int igbvf_get_settings(struct net_device *netdev,
        return 0;
 }
 
-static u32 igbvf_get_link(struct net_device *netdev)
-{
-       return netif_carrier_ok(netdev);
-}
-
 static int igbvf_set_settings(struct net_device *netdev,
                               struct ethtool_cmd *ecmd)
 {
@@ -515,7 +510,7 @@ static const struct ethtool_ops igbvf_ethtool_ops = {
        .get_msglevel           = igbvf_get_msglevel,
        .set_msglevel           = igbvf_set_msglevel,
        .nway_reset             = igbvf_nway_reset,
-       .get_link               = igbvf_get_link,
+       .get_link               = ethtool_op_get_link,
        .get_eeprom_len         = igbvf_get_eeprom_len,
        .get_eeprom             = igbvf_get_eeprom,
        .set_eeprom             = igbvf_set_eeprom,
index 38e15be6d5135e00af3766da939f5ab93c5db87b..63ac531f599624b90f68c359f0b331ab0e24781d 100644 (file)
@@ -1009,15 +1009,10 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        return 0;
 }
 
-static u32 veth_get_link(struct net_device *dev)
-{
-       return 1;
-}
-
 static const struct ethtool_ops ops = {
        .get_drvinfo = veth_get_drvinfo,
        .get_settings = veth_get_settings,
-       .get_link = veth_get_link,
+       .get_link = ethtool_op_get_link,
 };
 
 static const struct net_device_ops veth_netdev_ops = {
index dd2b6a71c6d70f15dc18312b13c616370f94c16a..ce31e74a559bc4110ad4c82371adfcbcbc38b644 100644 (file)
@@ -1514,11 +1514,6 @@ static int mv643xx_eth_nway_reset(struct net_device *dev)
        return genphy_restart_aneg(mp->phy);
 }
 
-static u32 mv643xx_eth_get_link(struct net_device *dev)
-{
-       return !!netif_carrier_ok(dev);
-}
-
 static int
 mv643xx_eth_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
 {
@@ -1658,7 +1653,7 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
        .set_settings           = mv643xx_eth_set_settings,
        .get_drvinfo            = mv643xx_eth_get_drvinfo,
        .nway_reset             = mv643xx_eth_nway_reset,
-       .get_link               = mv643xx_eth_get_link,
+       .get_link               = ethtool_op_get_link,
        .get_coalesce           = mv643xx_eth_get_coalesce,
        .set_coalesce           = mv643xx_eth_set_coalesce,
        .get_ringparam          = mv643xx_eth_get_ringparam,
index 18c0297743f122f488cc01a935adcb720ec9a32a..04ed27d0b6bebb3df8938dbf97d668a8bb347e99 100644 (file)
@@ -1450,16 +1450,11 @@ static void pxa168_get_drvinfo(struct net_device *dev,
        strncpy(info->bus_info, "N/A", 32);
 }
 
-static u32 pxa168_get_link(struct net_device *dev)
-{
-       return !!netif_carrier_ok(dev);
-}
-
 static const struct ethtool_ops pxa168_ethtool_ops = {
        .get_settings = pxa168_get_settings,
        .set_settings = pxa168_set_settings,
        .get_drvinfo = pxa168_get_drvinfo,
-       .get_link = pxa168_get_link,
+       .get_link = ethtool_op_get_link,
 };
 
 static const struct net_device_ops pxa168_eth_netdev_ops = {
index 5e50e57b0ae2a74a55174ff31a932323c4843811..0e8bb19ed60d6f8bf78efb6b0910a8f4d94907bb 100644 (file)
@@ -620,13 +620,6 @@ static int efx_ethtool_nway_reset(struct net_device *net_dev)
        return mdio45_nway_restart(&efx->mdio);
 }
 
-static u32 efx_ethtool_get_link(struct net_device *net_dev)
-{
-       struct efx_nic *efx = netdev_priv(net_dev);
-
-       return efx->link_state.up;
-}
-
 static int efx_ethtool_get_coalesce(struct net_device *net_dev,
                                    struct ethtool_coalesce *coalesce)
 {
@@ -1047,7 +1040,7 @@ const struct ethtool_ops efx_ethtool_ops = {
        .get_msglevel           = efx_ethtool_get_msglevel,
        .set_msglevel           = efx_ethtool_set_msglevel,
        .nway_reset             = efx_ethtool_nway_reset,
-       .get_link               = efx_ethtool_get_link,
+       .get_link               = ethtool_op_get_link,
        .get_coalesce           = efx_ethtool_get_coalesce,
        .set_coalesce           = efx_ethtool_set_coalesce,
        .get_ringparam          = efx_ethtool_get_ringparam,
index 2cf84e5968b2b3217fd487c53f82420d31f71868..767e1e2b210dcd6bb3a5dfdb44f4d73451ba0835 100644 (file)
@@ -1295,17 +1295,9 @@ static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvin
        strcpy(info->version, "2.02");
 }
 
-static u32 sparc_lance_get_link(struct net_device *dev)
-{
-       /* We really do not keep track of this, but this
-        * is better than not reporting anything at all.
-        */
-       return 1;
-}
-
 static const struct ethtool_ops sparc_lance_ethtool_ops = {
        .get_drvinfo            = sparc_lance_get_drvinfo,
-       .get_link               = sparc_lance_get_link,
+       .get_link               = ethtool_op_get_link,
 };
 
 static const struct net_device_ops sparc_lance_ops = {