diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2010-09-11 09:33:29 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-07-25 12:26:56 -0400 |
commit | c8e58856f2f288bfe076ad9205d9a10623498c96 (patch) | |
tree | 23b083b4e924bff956253e6aee8e59c92dbd64eb /arch/mips/rb532/devices.c | |
parent | 5fba0960809534f008260a621046f38a5f46f417 (diff) |
MIPS: RB532: Use hex_to_bin()
Remove custom implementation of hex_to_bin().
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
To: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/1580/
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/rb532/devices.c')
-rw-r--r-- | arch/mips/rb532/devices.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index 041fc1afc3f4..a969eb826634 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c | |||
@@ -251,28 +251,22 @@ static struct platform_device *rb532_devs[] = { | |||
251 | 251 | ||
252 | static void __init parse_mac_addr(char *macstr) | 252 | static void __init parse_mac_addr(char *macstr) |
253 | { | 253 | { |
254 | int i, j; | 254 | int i, h, l; |
255 | unsigned char result, value; | ||
256 | 255 | ||
257 | for (i = 0; i < 6; i++) { | 256 | for (i = 0; i < 6; i++) { |
258 | result = 0; | ||
259 | |||
260 | if (i != 5 && *(macstr + 2) != ':') | 257 | if (i != 5 && *(macstr + 2) != ':') |
261 | return; | 258 | return; |
262 | 259 | ||
263 | for (j = 0; j < 2; j++) { | 260 | h = hex_to_bin(*macstr++); |
264 | if (isxdigit(*macstr) | 261 | if (h == -1) |
265 | && (value = | 262 | return; |
266 | isdigit(*macstr) ? *macstr - | 263 | |
267 | '0' : toupper(*macstr) - 'A' + 10) < 16) { | 264 | l = hex_to_bin(*macstr++); |
268 | result = result * 16 + value; | 265 | if (l == -1) |
269 | macstr++; | 266 | return; |
270 | } else | ||
271 | return; | ||
272 | } | ||
273 | 267 | ||
274 | macstr++; | 268 | macstr++; |
275 | korina_dev0_data.mac[i] = result; | 269 | korina_dev0_data.mac[i] = (h << 4) + l; |
276 | } | 270 | } |
277 | } | 271 | } |
278 | 272 | ||