From ca7ee5f4b947250ab16c93966db16e26ebd82a72 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 26 Aug 2003 09:52:11 -0400 Subject: [PATCH] [netdrvr xircom_cb] ethtool_ops support Also, export PCI bus id via ETHTOOL_GDRVINFO. --- drivers/net/tulip/xircom_cb.c | 38 +++++++++-------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 518121a6c12f3..2d835d645fe87 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c @@ -175,37 +175,19 @@ static void print_binary(unsigned int number) } #endif -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) -{ - u32 ethcmd; - - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) - return -EFAULT; - - switch (ethcmd) { - case ETHTOOL_GDRVINFO: { - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; - strncpy(info.driver, "xircom_cb", sizeof(info.driver)-1); - if (copy_to_user(useraddr, &info, sizeof(info))) - return -EFAULT; - return 0; - } - } - - return -EOPNOTSUPP; -} - -static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static void netdev_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) { + struct xircom_private *private = dev->priv; - switch(cmd) { - case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); - default: - return -EOPNOTSUPP; - } + strcpy(info->driver, "xircom_cb"); + strcpy(info->bus_info, pci_name(private->pdev)); } +static struct ethtool_ops netdev_ethtool_ops = { + .get_drvinfo = netdev_get_drvinfo, +}; + /* xircom_probe is the code that gets called on device insertion. it sets up the hardware and registers the device to the networklayer. @@ -287,7 +269,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ dev->stop = &xircom_close; dev->get_stats = &xircom_get_stats; dev->priv = private; - dev->do_ioctl = &private_ioctl; + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); pci_set_drvdata(pdev, dev); -- 2.53.0