aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/cdc_ether.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
commit2ed0e21b30b53d3a94e204196e523e6c8f732b56 (patch)
treede2635426477d86338a9469ce09ba0626052288f /drivers/net/usb/cdc_ether.c
parent0fa213310cd8fa7a51071cdcf130e26fa56e9549 (diff)
parent9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1244 commits) pkt_sched: Rename PSCHED_US2NS and PSCHED_NS2US ipv4: Fix fib_trie rebalancing Bluetooth: Fix issue with uninitialized nsh.type in DTL-1 driver Bluetooth: Fix Kconfig issue with RFKILL integration PIM-SM: namespace changes ipv4: update ARPD help text net: use a deferred timer in rt_check_expire ieee802154: fix kconfig bool/tristate muckup bonding: initialization rework bonding: use is_zero_ether_addr bonding: network device names are case sensative bonding: elminate bad refcount code bonding: fix style issues bonding: fix destructor bonding: remove bonding read/write semaphore bonding: initialize before registration bonding: bond_create always called with default parameters x_tables: Convert printk to pr_err netfilter: conntrack: optional reliable conntrack event delivery list_nulls: add hlist_nulls_add_head and hlist_nulls_del ...
Diffstat (limited to 'drivers/net/usb/cdc_ether.c')
-rw-r--r--drivers/net/usb/cdc_ether.c33
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
392static 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
402static inline int
403get_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
422static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) 391static 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);