Commit 42e1e53d authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (14/27) ns83820 ethtool conversion

parent 2086582b
......@@ -1192,59 +1192,26 @@ static struct net_device_stats *ns83820_get_stats(struct net_device *ndev)
return &dev->stats;
}
static int ns83820_ethtool_ioctl (struct ns83820 *dev, void __user *useraddr)
static void ns83820_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO:
{
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy(info.driver, "ns83820");
strcpy(info.version, VERSION);
strcpy(info.bus_info, pci_name(dev->pci_dev));
if (copy_to_user(useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
/* get link status */
case ETHTOOL_GLINK: {
struct ethtool_value edata = { ETHTOOL_GLINK };
u32 cfg = readl(dev->base + CFG) ^ SPDSTS_POLARITY;
if (cfg & CFG_LNKSTS)
edata.data = 1;
else
edata.data = 0;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
struct ns83820 *dev = PRIV(ndev);
strcpy(info->driver, "ns83820");
strcpy(info->version, VERSION);
strcpy(info->bus_info, pci_name(dev->pci_dev));
}
static int ns83820_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
static u32 ns83820_get_link(struct net_device *ndev)
{
struct ns83820 *dev = PRIV(ndev);
switch(cmd) {
case SIOCETHTOOL:
return ns83820_ethtool_ioctl(dev, rq->ifr_data);
default:
return -EOPNOTSUPP;
}
u32 cfg = readl(dev->base + CFG) ^ SPDSTS_POLARITY;
return cfg & CFG_LNKSTS ? 1 : 0;
}
static struct ethtool_ops ops = {
.get_drvinfo = ns83820_get_drvinfo,
.get_link = ns83820_get_link
};
static void ns83820_mib_isr(struct ns83820 *dev)
{
spin_lock(&dev->misc_lock);
......@@ -1884,7 +1851,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
ndev->get_stats = ns83820_get_stats;
ndev->change_mtu = ns83820_change_mtu;
ndev->set_multicast_list = ns83820_set_multicast;
ndev->do_ioctl = ns83820_ioctl;
SET_ETHTOOL_OPS(ndev, &ops);
ndev->tx_timeout = ns83820_tx_timeout;
ndev->watchdog_timeo = 5 * HZ;
......
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