]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/core/ethtool.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[karo-tx-linux.git] / net / core / ethtool.c
index d5bc288188830970a4e0439f7e26b4b131082f00..17741782a345f78328a881da5887f6e81834f5b6 100644 (file)
@@ -891,6 +891,20 @@ static int ethtool_nway_reset(struct net_device *dev)
        return dev->ethtool_ops->nway_reset(dev);
 }
 
+static int ethtool_get_link(struct net_device *dev, char __user *useraddr)
+{
+       struct ethtool_value edata = { .cmd = ETHTOOL_GLINK };
+
+       if (!dev->ethtool_ops->get_link)
+               return -EOPNOTSUPP;
+
+       edata.data = netif_running(dev) && dev->ethtool_ops->get_link(dev);
+
+       if (copy_to_user(useraddr, &edata, sizeof(edata)))
+               return -EFAULT;
+       return 0;
+}
+
 static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
 {
        struct ethtool_eeprom eeprom;
@@ -1530,8 +1544,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
                rc = ethtool_nway_reset(dev);
                break;
        case ETHTOOL_GLINK:
-               rc = ethtool_get_value(dev, useraddr, ethcmd,
-                                      dev->ethtool_ops->get_link);
+               rc = ethtool_get_link(dev, useraddr);
                break;
        case ETHTOOL_GEEPROM:
                rc = ethtool_get_eeprom(dev, useraddr);