]> git.hungrycats.org Git - linux/commitdiff
[netdrvr xircom_cb] ethtool_ops support
authorJeff Garzik <jgarzik@redhat.com>
Tue, 26 Aug 2003 13:52:11 +0000 (09:52 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 26 Aug 2003 13:52:11 +0000 (09:52 -0400)
Also, export PCI bus id via ETHTOOL_GDRVINFO.

drivers/net/tulip/xircom_cb.c

index 518121a6c12f367e43ef0a6f072d1b6402de233b..2d835d645fe87c2bbcadaf025eb6db5bb1e915e7 100644 (file)
@@ -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(&ethcmd, 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);