]> git.hungrycats.org Git - linux/commitdiff
[netdrvr 3c59x] ethtool_ops support
authorMatthew Wilcox <willy@debian.org>
Tue, 26 Aug 2003 10:23:26 +0000 (06:23 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 26 Aug 2003 10:23:26 +0000 (06:23 -0400)
drivers/net/3c59x.c

index e86b78d1de94c2d50633ce238e651c79af318d9b..4e3eabe1e5eae64de3bd713bc358cb82046b9955 100644 (file)
@@ -900,6 +900,7 @@ static void set_rx_mode(struct net_device *dev);
 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static void vortex_tx_timeout(struct net_device *dev);
 static void acpi_set_WOL(struct net_device *dev);
+static struct ethtool_ops vortex_ethtool_ops;
 \f
 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
 /* Option count limit only -- unlimited interfaces are supported. */
@@ -1445,6 +1446,7 @@ static int __devinit vortex_probe1(struct device *gendev,
        dev->stop = vortex_close;
        dev->get_stats = vortex_get_stats;
        dev->do_ioctl = vortex_ioctl;
+       dev->ethtool_ops = &vortex_ethtool_ops;
        dev->set_multicast_list = set_rx_mode;
        dev->tx_timeout = vortex_tx_timeout;
        dev->watchdog_timeo = (watchdog * HZ) / 1000;
@@ -2816,38 +2818,28 @@ static void update_stats(long ioaddr, struct net_device *dev)
 }
 
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static void vortex_get_drvinfo(struct net_device *dev,
+                                       struct ethtool_drvinfo *info)
 {
        struct vortex_private *vp = dev->priv;
-       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, DRV_NAME);
-               strcpy(info.version, DRV_VERSION);
-               if (VORTEX_PCI(vp))
-                       strcpy(info.bus_info, pci_name(VORTEX_PCI(vp)));
-               else {
-                       if (VORTEX_EISA(vp))
-                               sprintf (info.bus_info, vp->gendev->bus_id);
-                       else
-                               sprintf(info.bus_info, "EISA 0x%lx %d",
-                                               dev->base_addr, dev->irq);
-               }
-               if (copy_to_user(useraddr, &info, sizeof(info)))
-                       return -EFAULT;
-               return 0;
-       }
 
-        }
-       
-       return -EOPNOTSUPP;
+       strcpy(info->driver, DRV_NAME);
+       strcpy(info->version, DRV_VERSION);
+       if (VORTEX_PCI(vp)) {
+               strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
+       } else {
+               if (VORTEX_EISA(vp))
+                       sprintf(info->bus_info, vp->gendev->bus_id);
+               else
+                       sprintf(info->bus_info, "EISA 0x%lx %d",
+                                       dev->base_addr, dev->irq);
+       }
 }
 
+static struct ethtool_ops vortex_ethtool_ops = {
+       .get_drvinfo =          vortex_get_drvinfo,
+};
+
 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
        struct vortex_private *vp = (struct vortex_private *)dev->priv;
@@ -2857,9 +2849,6 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        int retval;
 
        switch(cmd) {
-       case SIOCETHTOOL:
-               return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
-
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = phy;