Commit 7b022a1b authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: smsc: smc91x: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Tested-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b78125e0
...@@ -1535,32 +1535,33 @@ static int smc_close(struct net_device *dev) ...@@ -1535,32 +1535,33 @@ static int smc_close(struct net_device *dev)
* Ethtool support * Ethtool support
*/ */
static int static int
smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) smc_ethtool_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ {
struct smc_local *lp = netdev_priv(dev); struct smc_local *lp = netdev_priv(dev);
int ret; int ret;
cmd->maxtxpkt = 1;
cmd->maxrxpkt = 1;
if (lp->phy_type != 0) { if (lp->phy_type != 0) {
spin_lock_irq(&lp->lock); spin_lock_irq(&lp->lock);
ret = mii_ethtool_gset(&lp->mii, cmd); ret = mii_ethtool_get_link_ksettings(&lp->mii, cmd);
spin_unlock_irq(&lp->lock); spin_unlock_irq(&lp->lock);
} else { } else {
cmd->supported = SUPPORTED_10baseT_Half | u32 supported = SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
SUPPORTED_TP | SUPPORTED_AUI; SUPPORTED_TP | SUPPORTED_AUI;
if (lp->ctl_rspeed == 10) if (lp->ctl_rspeed == 10)
ethtool_cmd_speed_set(cmd, SPEED_10); cmd->base.speed = SPEED_10;
else if (lp->ctl_rspeed == 100) else if (lp->ctl_rspeed == 100)
ethtool_cmd_speed_set(cmd, SPEED_100); cmd->base.speed = SPEED_100;
cmd->base.autoneg = AUTONEG_DISABLE;
cmd->base.port = 0;
cmd->base.duplex = lp->tcr_cur_mode & TCR_SWFDUP ?
DUPLEX_FULL : DUPLEX_HALF;
cmd->autoneg = AUTONEG_DISABLE; ethtool_convert_legacy_u32_to_link_mode(
cmd->transceiver = XCVR_INTERNAL; cmd->link_modes.supported, supported);
cmd->port = 0;
cmd->duplex = lp->tcr_cur_mode & TCR_SWFDUP ? DUPLEX_FULL : DUPLEX_HALF;
ret = 0; ret = 0;
} }
...@@ -1569,24 +1570,26 @@ smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -1569,24 +1570,26 @@ smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
} }
static int static int
smc_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) smc_ethtool_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ {
struct smc_local *lp = netdev_priv(dev); struct smc_local *lp = netdev_priv(dev);
int ret; int ret;
if (lp->phy_type != 0) { if (lp->phy_type != 0) {
spin_lock_irq(&lp->lock); spin_lock_irq(&lp->lock);
ret = mii_ethtool_sset(&lp->mii, cmd); ret = mii_ethtool_set_link_ksettings(&lp->mii, cmd);
spin_unlock_irq(&lp->lock); spin_unlock_irq(&lp->lock);
} else { } else {
if (cmd->autoneg != AUTONEG_DISABLE || if (cmd->base.autoneg != AUTONEG_DISABLE ||
cmd->speed != SPEED_10 || cmd->base.speed != SPEED_10 ||
(cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL) || (cmd->base.duplex != DUPLEX_HALF &&
(cmd->port != PORT_TP && cmd->port != PORT_AUI)) cmd->base.duplex != DUPLEX_FULL) ||
(cmd->base.port != PORT_TP && cmd->base.port != PORT_AUI))
return -EINVAL; return -EINVAL;
// lp->port = cmd->port; // lp->port = cmd->base.port;
lp->ctl_rfduplx = cmd->duplex == DUPLEX_FULL; lp->ctl_rfduplx = cmd->base.duplex == DUPLEX_FULL;
// if (netif_running(dev)) // if (netif_running(dev))
// smc_set_port(dev); // smc_set_port(dev);
...@@ -1744,8 +1747,6 @@ static int smc_ethtool_seteeprom(struct net_device *dev, ...@@ -1744,8 +1747,6 @@ static int smc_ethtool_seteeprom(struct net_device *dev,
static const struct ethtool_ops smc_ethtool_ops = { static const struct ethtool_ops smc_ethtool_ops = {
.get_settings = smc_ethtool_getsettings,
.set_settings = smc_ethtool_setsettings,
.get_drvinfo = smc_ethtool_getdrvinfo, .get_drvinfo = smc_ethtool_getdrvinfo,
.get_msglevel = smc_ethtool_getmsglevel, .get_msglevel = smc_ethtool_getmsglevel,
...@@ -1755,6 +1756,8 @@ static const struct ethtool_ops smc_ethtool_ops = { ...@@ -1755,6 +1756,8 @@ static const struct ethtool_ops smc_ethtool_ops = {
.get_eeprom_len = smc_ethtool_geteeprom_len, .get_eeprom_len = smc_ethtool_geteeprom_len,
.get_eeprom = smc_ethtool_geteeprom, .get_eeprom = smc_ethtool_geteeprom,
.set_eeprom = smc_ethtool_seteeprom, .set_eeprom = smc_ethtool_seteeprom,
.get_link_ksettings = smc_ethtool_get_link_ksettings,
.set_link_ksettings = smc_ethtool_set_link_ksettings,
}; };
static const struct net_device_ops smc_netdev_ops = { static const struct net_device_ops smc_netdev_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment