--- linux-2.6-hso/drivers/net/usb/hso.c 2008-04-16 14:47:53.000000000 +0300 +++ linux-2.6-hso-my/drivers/net/usb/hso.c 2008-04-16 18:01:11.000000000 +0300 @@ -853,61 +853,22 @@ static int hso_net_start_xmit(struct sk_ return result; } -static int hso_net_ioctl(struct net_device *net, struct ifreq *rq, int cmd) +static void hso_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) { struct hso_net *odev = netdev_priv(net); - u32 usercmd = 0; - char tmp[40]; - switch (cmd) { - case SIOCETHTOOL: - /* net specific */ - if (copy_from_user(&usercmd, rq->ifr_data, sizeof(usercmd))) - return -EFAULT; - - switch (usercmd) { - case ETHTOOL_GDRVINFO: - { - /* get driver info */ - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO }; - strncpy(info.driver, driver_name, ETHTOOL_BUSINFO_LEN); - strncpy(info.version, DRIVER_VERSION, - ETHTOOL_BUSINFO_LEN); - sprintf(tmp, "usb%d:%d", - odev->parent->usb->bus->busnum, - odev->parent->usb->devnum); - strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN); - sprintf(tmp, "%s %x.%x", driver_name, - ((odev->bcdCDC & 0xff00) >> 8), - (odev->bcdCDC & 0x00ff)); - strncpy(info.fw_version, tmp, ETHTOOL_BUSINFO_LEN); - if (copy_to_user(rq->ifr_data, &info, sizeof(info))) - return -EFAULT; - - return 0; - } - case ETHTOOL_GLINK: - { - /* get link status */ - struct ethtool_value edata = { ETHTOOL_GLINK }; - - edata.data = netif_carrier_ok(net); - if (copy_to_user(rq->ifr_data, &edata, sizeof(edata))) - return -EFAULT; - - return 0; - } - default: - dev_warn(&net->dev, "Got unsupported ioctl: %x\n", - usercmd); - /* the ethtool user space tool relies on this */ - return -EOPNOTSUPP; - } - default: - return -ENOTTY; /* per ioctl man page */ - } + strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); + strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); + usb_make_path(odev->parent->usb, info->bus_info, sizeof info->bus_info); + snprintf(info->fw_version, ETHTOOL_BUSINFO_LEN, "%s %x.%x", driver_name, + ((odev->bcdCDC & 0xff00) >> 8), (odev->bcdCDC & 0x00ff)); } +static struct ethtool_ops ops = { + .get_drvinfo = hso_get_drvinfo, + .get_link = ethtool_op_get_link +}; + static struct net_device_stats *hso_net_get_stats(struct net_device *net) { return &((struct hso_net *)netdev_priv(net))->stats; @@ -2281,7 +2242,6 @@ static void hso_net_init(struct net_devi net->open = hso_net_open; net->stop = hso_net_close; net->hard_start_xmit = hso_net_start_xmit; - net->do_ioctl = hso_net_ioctl; net->get_stats = hso_net_get_stats; net->tx_timeout = hso_net_tx_timeout; net->watchdog_timeo = HSO_NET_TX_TIMEOUT; @@ -2289,6 +2249,7 @@ static void hso_net_init(struct net_devi net->flags |= IFF_NOARP; net->mtu = DEFAULT_MTU - 14; net->tx_queue_len = 10; + SET_ETHTOOL_OPS(net, &ops); hso_net->skb_rx_buf = NULL; hso_net->rx_parse_state = WAIT_IP; hso_net->wMaxSegmentSize = DEFAULT_MTU;