diff options
Diffstat (limited to 'drivers/net/usb/cdc_ether.c')
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 55e8ecc3a9e5..01fd528306ec 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
27 | #include <linux/etherdevice.h> | 27 | #include <linux/etherdevice.h> |
28 | #include <linux/ctype.h> | ||
29 | #include <linux/ethtool.h> | 28 | #include <linux/ethtool.h> |
30 | #include <linux/workqueue.h> | 29 | #include <linux/workqueue.h> |
31 | #include <linux/mii.h> | 30 | #include <linux/mii.h> |
@@ -389,36 +388,6 @@ static void cdc_status(struct usbnet *dev, struct urb *urb) | |||
389 | } | 388 | } |
390 | } | 389 | } |
391 | 390 | ||
392 | static u8 nibble(unsigned char c) | ||
393 | { | ||
394 | if (likely(isdigit(c))) | ||
395 | return c - '0'; | ||
396 | c = toupper(c); | ||
397 | if (likely(isxdigit(c))) | ||
398 | return 10 + c - 'A'; | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static inline int | ||
403 | get_ethernet_addr(struct usbnet *dev, struct usb_cdc_ether_desc *e) | ||
404 | { | ||
405 | int tmp, i; | ||
406 | unsigned char buf [13]; | ||
407 | |||
408 | tmp = usb_string(dev->udev, e->iMACAddress, buf, sizeof buf); | ||
409 | if (tmp != 12) { | ||
410 | dev_dbg(&dev->udev->dev, | ||
411 | "bad MAC string %d fetch, %d\n", e->iMACAddress, tmp); | ||
412 | if (tmp >= 0) | ||
413 | tmp = -EINVAL; | ||
414 | return tmp; | ||
415 | } | ||
416 | for (i = tmp = 0; i < 6; i++, tmp += 2) | ||
417 | dev->net->dev_addr [i] = | ||
418 | (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); | ||
419 | return 0; | ||
420 | } | ||
421 | |||
422 | static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) | 391 | static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) |
423 | { | 392 | { |
424 | int status; | 393 | int status; |
@@ -428,7 +397,7 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
428 | if (status < 0) | 397 | if (status < 0) |
429 | return status; | 398 | return status; |
430 | 399 | ||
431 | status = get_ethernet_addr(dev, info->ether); | 400 | status = usbnet_get_ethernet_addr(dev, info->ether->iMACAddress); |
432 | if (status < 0) { | 401 | if (status < 0) { |
433 | usb_set_intfdata(info->data, NULL); | 402 | usb_set_intfdata(info->data, NULL); |
434 | usb_driver_release_interface(driver_of(intf), info->data); | 403 | usb_driver_release_interface(driver_of(intf), info->data); |