mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
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>
This commit is contained in:
parent
5fba096080
commit
c8e58856f2
1 changed files with 9 additions and 15 deletions
|
@ -251,28 +251,22 @@ static struct platform_device *rb532_devs[] = {
|
||||||
|
|
||||||
static void __init parse_mac_addr(char *macstr)
|
static void __init parse_mac_addr(char *macstr)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, h, l;
|
||||||
unsigned char result, value;
|
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
result = 0;
|
|
||||||
|
|
||||||
if (i != 5 && *(macstr + 2) != ':')
|
if (i != 5 && *(macstr + 2) != ':')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (j = 0; j < 2; j++) {
|
h = hex_to_bin(*macstr++);
|
||||||
if (isxdigit(*macstr)
|
if (h == -1)
|
||||||
&& (value =
|
return;
|
||||||
isdigit(*macstr) ? *macstr -
|
|
||||||
'0' : toupper(*macstr) - 'A' + 10) < 16) {
|
l = hex_to_bin(*macstr++);
|
||||||
result = result * 16 + value;
|
if (l == -1)
|
||||||
macstr++;
|
|
||||||
} else
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
macstr++;
|
macstr++;
|
||||||
korina_dev0_data.mac[i] = result;
|
korina_dev0_data.mac[i] = (h << 4) + l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue