* [PATCH v1] usbnet: re-use native hex2bin()
@ 2015-01-22 21:27 Andy Shevchenko
2015-01-23 8:12 ` Oliver Neukum
2015-01-25 8:09 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2015-01-22 21:27 UTC (permalink / raw)
To: Oliver Neukum, netdev; +Cc: Andy Shevchenko
Call hex2bin() library function, instead of doing conversion here.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/net/usb/usbnet.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3a6770a..449835f 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -160,20 +160,19 @@ EXPORT_SYMBOL_GPL(usbnet_get_endpoints);
int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress)
{
- int tmp, i;
+ int tmp = -1, ret;
unsigned char buf [13];
- tmp = usb_string(dev->udev, iMACAddress, buf, sizeof buf);
- if (tmp != 12) {
+ ret = usb_string(dev->udev, iMACAddress, buf, sizeof buf);
+ if (ret == 12)
+ tmp = hex2bin(dev->net->dev_addr, buf, 6);
+ if (tmp < 0) {
dev_dbg(&dev->udev->dev,
"bad MAC string %d fetch, %d\n", iMACAddress, tmp);
- if (tmp >= 0)
- tmp = -EINVAL;
- return tmp;
+ if (ret >= 0)
+ ret = -EINVAL;
+ return ret;
}
- for (i = tmp = 0; i < 6; i++, tmp += 2)
- dev->net->dev_addr [i] =
- (hex_to_bin(buf[tmp]) << 4) + hex_to_bin(buf[tmp + 1]);
return 0;
}
EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr);
--
1.8.3.101.g727a46b
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] usbnet: re-use native hex2bin()
2015-01-22 21:27 [PATCH v1] usbnet: re-use native hex2bin() Andy Shevchenko
@ 2015-01-23 8:12 ` Oliver Neukum
2015-01-25 8:09 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2015-01-23 8:12 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: netdev
On Thu, 2015-01-22 at 23:27 +0200, Andy Shevchenko wrote:
> Call hex2bin() library function, instead of doing conversion here.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] usbnet: re-use native hex2bin()
2015-01-22 21:27 [PATCH v1] usbnet: re-use native hex2bin() Andy Shevchenko
2015-01-23 8:12 ` Oliver Neukum
@ 2015-01-25 8:09 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-01-25 8:09 UTC (permalink / raw)
To: andy.shevchenko; +Cc: oneukum, netdev
From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Thu, 22 Jan 2015 23:27:12 +0200
> Call hex2bin() library function, instead of doing conversion here.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-25 8:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 21:27 [PATCH v1] usbnet: re-use native hex2bin() Andy Shevchenko
2015-01-23 8:12 ` Oliver Neukum
2015-01-25 8:09 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.