Skip to content

Commit

Permalink
MIPS: RB532: Use hex_to_bin()
Browse files Browse the repository at this point in the history
Remove custom implementation of hex_to_bin().

Signed-off-by: Andy Shevchenko <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: [email protected]
To: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/1580/
Acked-by: Florian Fainelli <[email protected]>
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
andy-shev authored and ralfbaechle committed Jul 25, 2011
1 parent 5fba096 commit c8e5885
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions arch/mips/rb532/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,22 @@ static struct platform_device *rb532_devs[] = {

static void __init parse_mac_addr(char *macstr)
{
int i, j;
unsigned char result, value;
int i, h, l;

for (i = 0; i < 6; i++) {
result = 0;

if (i != 5 && *(macstr + 2) != ':')
return;

for (j = 0; j < 2; j++) {
if (isxdigit(*macstr)
&& (value =
isdigit(*macstr) ? *macstr -
'0' : toupper(*macstr) - 'A' + 10) < 16) {
result = result * 16 + value;
macstr++;
} else
return;
}
h = hex_to_bin(*macstr++);
if (h == -1)
return;

l = hex_to_bin(*macstr++);
if (l == -1)
return;

macstr++;
korina_dev0_data.mac[i] = result;
korina_dev0_data.mac[i] = (h << 4) + l;
}
}

Expand Down

0 comments on commit c8e5885

Please sign in to comment.