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

net: usb: rtl8150: 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>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06144dcf
...@@ -791,47 +791,52 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinf ...@@ -791,47 +791,52 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinf
usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
} }
static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) static int rtl8150_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *ecmd)
{ {
rtl8150_t *dev = netdev_priv(netdev); rtl8150_t *dev = netdev_priv(netdev);
short lpa, bmcr; short lpa, bmcr;
u32 supported;
ecmd->supported = (SUPPORTED_10baseT_Half | supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Half |
SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg | SUPPORTED_Autoneg |
SUPPORTED_TP | SUPPORTED_MII); SUPPORTED_TP | SUPPORTED_MII);
ecmd->port = PORT_TP; ecmd->base.port = PORT_TP;
ecmd->transceiver = XCVR_INTERNAL; ecmd->base.phy_address = dev->phy;
ecmd->phy_address = dev->phy;
get_registers(dev, BMCR, 2, &bmcr); get_registers(dev, BMCR, 2, &bmcr);
get_registers(dev, ANLP, 2, &lpa); get_registers(dev, ANLP, 2, &lpa);
if (bmcr & BMCR_ANENABLE) { if (bmcr & BMCR_ANENABLE) {
u32 speed = ((lpa & (LPA_100HALF | LPA_100FULL)) ? u32 speed = ((lpa & (LPA_100HALF | LPA_100FULL)) ?
SPEED_100 : SPEED_10); SPEED_100 : SPEED_10);
ethtool_cmd_speed_set(ecmd, speed); ecmd->base.speed = speed;
ecmd->autoneg = AUTONEG_ENABLE; ecmd->base.autoneg = AUTONEG_ENABLE;
if (speed == SPEED_100) if (speed == SPEED_100)
ecmd->duplex = (lpa & LPA_100FULL) ? ecmd->base.duplex = (lpa & LPA_100FULL) ?
DUPLEX_FULL : DUPLEX_HALF; DUPLEX_FULL : DUPLEX_HALF;
else else
ecmd->duplex = (lpa & LPA_10FULL) ? ecmd->base.duplex = (lpa & LPA_10FULL) ?
DUPLEX_FULL : DUPLEX_HALF; DUPLEX_FULL : DUPLEX_HALF;
} else { } else {
ecmd->autoneg = AUTONEG_DISABLE; ecmd->base.autoneg = AUTONEG_DISABLE;
ethtool_cmd_speed_set(ecmd, ((bmcr & BMCR_SPEED100) ? ecmd->base.speed = ((bmcr & BMCR_SPEED100) ?
SPEED_100 : SPEED_10)); SPEED_100 : SPEED_10);
ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? ecmd->base.duplex = (bmcr & BMCR_FULLDPLX) ?
DUPLEX_FULL : DUPLEX_HALF; DUPLEX_FULL : DUPLEX_HALF;
} }
ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.supported,
supported);
return 0; return 0;
} }
static const struct ethtool_ops ops = { static const struct ethtool_ops ops = {
.get_drvinfo = rtl8150_get_drvinfo, .get_drvinfo = rtl8150_get_drvinfo,
.get_settings = rtl8150_get_settings, .get_link = ethtool_op_get_link,
.get_link = ethtool_op_get_link .get_link_ksettings = rtl8150_get_link_ksettings,
}; };
static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
......
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