diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2010-07-22 23:18:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-23 15:50:50 -0400 |
commit | fd1f170dfc9d432061540422ddc97058154d94b9 (patch) | |
tree | 7b84c7ef7812ef08dbb365625ea4a67e3a4753bc /drivers/net/usb/usbnet.c | |
parent | 5c4ac8c60aba4b2e9549d139586612855b0fea09 (diff) |
usb: usbnet: use newly introduced hex_to_bin()
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/usbnet.c')
-rw-r--r-- | drivers/net/usb/usbnet.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 7eab4071ea26..f5e1639b3224 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/usb.h> | 44 | #include <linux/usb.h> |
45 | #include <linux/usb/usbnet.h> | 45 | #include <linux/usb/usbnet.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/kernel.h> | ||
47 | 48 | ||
48 | #define DRIVER_VERSION "22-Aug-2005" | 49 | #define DRIVER_VERSION "22-Aug-2005" |
49 | 50 | ||
@@ -158,16 +159,6 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf) | |||
158 | } | 159 | } |
159 | EXPORT_SYMBOL_GPL(usbnet_get_endpoints); | 160 | EXPORT_SYMBOL_GPL(usbnet_get_endpoints); |
160 | 161 | ||
161 | static u8 nibble(unsigned char c) | ||
162 | { | ||
163 | if (likely(isdigit(c))) | ||
164 | return c - '0'; | ||
165 | c = toupper(c); | ||
166 | if (likely(isxdigit(c))) | ||
167 | return 10 + c - 'A'; | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress) | 162 | int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress) |
172 | { | 163 | { |
173 | int tmp, i; | 164 | int tmp, i; |
@@ -183,7 +174,7 @@ int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress) | |||
183 | } | 174 | } |
184 | for (i = tmp = 0; i < 6; i++, tmp += 2) | 175 | for (i = tmp = 0; i < 6; i++, tmp += 2) |
185 | dev->net->dev_addr [i] = | 176 | dev->net->dev_addr [i] = |
186 | (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); | 177 | (hex_to_bin(buf[tmp]) << 4) + hex_to_bin(buf[tmp + 1]); |
187 | return 0; | 178 | return 0; |
188 | } | 179 | } |
189 | EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); | 180 | EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); |