[PATCH 03/10] usb: atm: speedtch: use new hex_to_bin() method

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andy Shevchenko
Date: Friday, April 30, 2010 - 2:34 am

Instead of using own implementation which potentialy has bugs involve
hex_to_bin() function. It requires to have hex_to_bin() implementation
introduced by starter patch in series.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: Duncan Sands <duncan.sands@free.fr>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 drivers/usb/atm/speedtch.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 1e9ba4b..1335456 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -127,8 +127,6 @@ MODULE_PARM_DESC(ModemOption, "default: 0x10,0x00,0x00,0x00,0x20");
 #define ENDPOINT_ISOC_DATA	0x07
 #define ENDPOINT_FIRMWARE	0x05
 
-#define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) )
-
 struct speedtch_params {
 	unsigned int altsetting;
 	unsigned int BMaxDSL;
@@ -669,7 +667,8 @@ static int speedtch_atm_start(struct usbatm_data *usbatm, struct atm_dev *atm_de
 	memset(atm_dev->esi, 0, sizeof(atm_dev->esi));
 	if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) {
 		for (i = 0; i < 6; i++)
-			atm_dev->esi[i] = (hex2int(mac_str[i * 2]) * 16) + (hex2int(mac_str[i * 2 + 1]));
+			atm_dev->esi[i] = (hex_to_bin(mac_str[i * 2]) << 4) +
+				hex_to_bin(mac_str[i * 2 + 1]);
 	}
 
 	/* Start modem synchronisation */
-- 
1.6.3.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/10] Introduce common hex_to_bin() helper, Andy Shevchenko, (Fri Apr 30, 2:33 am)
[PATCH 02/10] drivers: isdn: use new hex_to_bin() method, Andy Shevchenko, (Fri Apr 30, 2:34 am)
[PATCH 03/10] usb: atm: speedtch: use new hex_to_bin() method, Andy Shevchenko, (Fri Apr 30, 2:34 am)
[PATCH 04/10] drivers: net: use new hex_to_bin() method, Andy Shevchenko, (Fri Apr 30, 2:34 am)
[PATCH 05/10] drivers: net: use new hex_to_bin() method, Andy Shevchenko, (Fri Apr 30, 2:34 am)
[PATCH 07/10] staging: rt2860: use new hex_to_bin() method, Andy Shevchenko, (Fri Apr 30, 2:34 am)
[PATCH 09/10] drivers: wireless: use new hex_to_bin() method, Andy Shevchenko, (Fri Apr 30, 2:34 am)
Re: [PATCH 09/10] drivers: wireless: use new hex_to_bin() ..., John W. Linville, (Fri Apr 30, 11:14 am)