Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed4ba4b5 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

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: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e596e6e4
Loading
Loading
Loading
Loading
+1 −15
Original line number Original line Diff line number Diff line
@@ -194,20 +194,6 @@ static int e1000_get_settings(struct net_device *netdev,
	return 0;
	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)
static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
{
{
	struct e1000_mac_info *mac = &adapter->hw.mac;
	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,
	.get_msglevel		= e1000_get_msglevel,
	.set_msglevel		= e1000_set_msglevel,
	.set_msglevel		= e1000_set_msglevel,
	.nway_reset		= e1000_nway_reset,
	.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_len		= e1000_get_eeprom_len,
	.get_eeprom		= e1000_get_eeprom,
	.get_eeprom		= e1000_get_eeprom,
	.set_eeprom		= e1000_set_eeprom,
	.set_eeprom		= e1000_set_eeprom,
+1 −6
Original line number Original line Diff line number Diff line
@@ -729,11 +729,6 @@ static void netdev_get_drvinfo(struct net_device *dev,
		sizeof(info->version) - 1);
		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)
static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data)
{
{
	struct ibmveth_adapter *adapter = netdev_priv(dev);
	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 = {
static const struct ethtool_ops netdev_ethtool_ops = {
	.get_drvinfo		= netdev_get_drvinfo,
	.get_drvinfo		= netdev_get_drvinfo,
	.get_settings		= netdev_get_settings,
	.get_settings		= netdev_get_settings,
	.get_link		= netdev_get_link,
	.get_link		= ethtool_op_get_link,
	.set_tx_csum		= ibmveth_set_tx_csum,
	.set_tx_csum		= ibmveth_set_tx_csum,
	.get_rx_csum		= ibmveth_get_rx_csum,
	.get_rx_csum		= ibmveth_get_rx_csum,
	.set_rx_csum		= ibmveth_set_rx_csum,
	.set_rx_csum		= ibmveth_set_rx_csum,
+1 −6
Original line number Original line Diff line number Diff line
@@ -110,11 +110,6 @@ static int igbvf_get_settings(struct net_device *netdev,
	return 0;
	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,
static int igbvf_set_settings(struct net_device *netdev,
                              struct ethtool_cmd *ecmd)
                              struct ethtool_cmd *ecmd)
{
{
@@ -515,7 +510,7 @@ static const struct ethtool_ops igbvf_ethtool_ops = {
	.get_msglevel		= igbvf_get_msglevel,
	.get_msglevel		= igbvf_get_msglevel,
	.set_msglevel		= igbvf_set_msglevel,
	.set_msglevel		= igbvf_set_msglevel,
	.nway_reset		= igbvf_nway_reset,
	.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_len		= igbvf_get_eeprom_len,
	.get_eeprom		= igbvf_get_eeprom,
	.get_eeprom		= igbvf_get_eeprom,
	.set_eeprom		= igbvf_set_eeprom,
	.set_eeprom		= igbvf_set_eeprom,
+1 −6
Original line number Original line Diff line number Diff line
@@ -1009,15 +1009,10 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
	return 0;
	return 0;
}
}


static u32 veth_get_link(struct net_device *dev)
{
	return 1;
}

static const struct ethtool_ops ops = {
static const struct ethtool_ops ops = {
	.get_drvinfo = veth_get_drvinfo,
	.get_drvinfo = veth_get_drvinfo,
	.get_settings = veth_get_settings,
	.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 = {
static const struct net_device_ops veth_netdev_ops = {
+1 −6
Original line number Original line Diff line number Diff line
@@ -1514,11 +1514,6 @@ static int mv643xx_eth_nway_reset(struct net_device *dev)
	return genphy_restart_aneg(mp->phy);
	return genphy_restart_aneg(mp->phy);
}
}


static u32 mv643xx_eth_get_link(struct net_device *dev)
{
	return !!netif_carrier_ok(dev);
}

static int
static int
mv643xx_eth_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
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,
	.set_settings		= mv643xx_eth_set_settings,
	.get_drvinfo		= mv643xx_eth_get_drvinfo,
	.get_drvinfo		= mv643xx_eth_get_drvinfo,
	.nway_reset		= mv643xx_eth_nway_reset,
	.nway_reset		= mv643xx_eth_nway_reset,
	.get_link		= mv643xx_eth_get_link,
	.get_link		= ethtool_op_get_link,
	.get_coalesce		= mv643xx_eth_get_coalesce,
	.get_coalesce		= mv643xx_eth_get_coalesce,
	.set_coalesce		= mv643xx_eth_set_coalesce,
	.set_coalesce		= mv643xx_eth_set_coalesce,
	.get_ringparam		= mv643xx_eth_get_ringparam,
	.get_ringparam		= mv643xx_eth_get_ringparam,
Loading