Skip to content

Commit

Permalink
net: ethernet: macb: use phy_ethtool_{get|set}_link_ksettings
Browse files Browse the repository at this point in the history
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Philippe Reynes authored and davem330 committed Jun 25, 2016
1 parent 0a91281 commit 176275a
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2091,28 +2091,6 @@ static struct net_device_stats *macb_get_stats(struct net_device *dev)
return nstat;
}

static int macb_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct macb *bp = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;

if (!phydev)
return -ENODEV;

return phy_ethtool_gset(phydev, cmd);
}

static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct macb *bp = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;

if (!phydev)
return -ENODEV;

return phy_ethtool_sset(phydev, cmd);
}

static int macb_get_regs_len(struct net_device *netdev)
{
return MACB_GREGS_NBR * sizeof(u32);
Expand Down Expand Up @@ -2185,26 +2163,26 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
}

static const struct ethtool_ops macb_ethtool_ops = {
.get_settings = macb_get_settings,
.set_settings = macb_set_settings,
.get_regs_len = macb_get_regs_len,
.get_regs = macb_get_regs,
.get_link = ethtool_op_get_link,
.get_ts_info = ethtool_op_get_ts_info,
.get_wol = macb_get_wol,
.set_wol = macb_set_wol,
.get_link_ksettings = phy_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
};

static const struct ethtool_ops gem_ethtool_ops = {
.get_settings = macb_get_settings,
.set_settings = macb_set_settings,
.get_regs_len = macb_get_regs_len,
.get_regs = macb_get_regs,
.get_link = ethtool_op_get_link,
.get_ts_info = ethtool_op_get_ts_info,
.get_ethtool_stats = gem_get_ethtool_stats,
.get_strings = gem_get_ethtool_strings,
.get_sset_count = gem_get_sset_count,
.get_link_ksettings = phy_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
};

static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
Expand Down

0 comments on commit 176275a

Please sign in to comment.