From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
To: linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>,
Duncan Sands <duncan.sands@free.fr>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 03/10] usb: atm: speedtch: use new hex_to_bin() method
Date: Fri, 30 Apr 2010 12:34:02 +0300 [thread overview]
Message-ID: <d4a1df27bf2c83ee84c3d74bcff0f2768146eb7e.1272617852.git.ext-andriy.shevchenko@nokia.com> (raw)
In-Reply-To: <1a326db89859eec030859e4905c515e0817bd2ea.1272617852.git.ext-andriy.shevchenko@nokia.com>
In-Reply-To: <cover.1272617852.git.ext-andriy.shevchenko@nokia.com>
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
next prev parent reply other threads:[~2010-04-30 17:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-30 9:33 [PATCH 00/10] Introduce common hex_to_bin() helper Andy Shevchenko
2010-04-30 9:34 ` [PATCH 01/10] lib: introduce common method to convert hex digits Andy Shevchenko
2010-04-30 9:34 ` [PATCH 02/10] drivers: isdn: use new hex_to_bin() method Andy Shevchenko
2010-04-30 9:34 ` Andy Shevchenko [this message]
2010-04-30 9:34 ` [PATCH 04/10] drivers: net: " Andy Shevchenko
2010-04-30 9:34 ` [PATCH 05/10] " Andy Shevchenko
2010-04-30 9:34 ` [PATCH 06/10] sysctl: don't use own implementation of hex_to_bin() Andy Shevchenko
2010-04-30 9:34 ` [PATCH 07/10] staging: rt2860: use new hex_to_bin() method Andy Shevchenko
2010-04-30 9:34 ` [PATCH 08/10] fs: ldm: don't use own implementation of hex_to_bin() Andy Shevchenko
2010-04-30 9:34 ` [PATCH 09/10] drivers: wireless: use new hex_to_bin() method Andy Shevchenko
2010-04-30 9:34 ` [PATCH 10/10] drivers: acpi: don't use own implementation of hex_to_bin() Andy Shevchenko
2010-04-30 18:14 ` [PATCH 09/10] drivers: wireless: use new hex_to_bin() method John W. Linville
2010-05-04 0:14 ` [PATCH 05/10] drivers: net: " Divy Le Ray
2010-04-30 19:07 ` [PATCH 01/10] lib: introduce common method to convert hex digits Andrew Morton
2010-05-01 2:55 ` Joe Perches
2010-05-02 18:12 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d4a1df27bf2c83ee84c3d74bcff0f2768146eb7e.1272617852.git.ext-andriy.shevchenko@nokia.com \
--to=ext-andriy.shevchenko@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=duncan.sands@free.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®