linux-mips
[Top] [All Lists]

[PATCH] arch: mips: use newly introduced hex_to_bin()

To: linux-kernel@vger.kernel.org
Subject: [PATCH] arch: mips: use newly introduced hex_to_bin()
From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Sat, 11 Sep 2010 16:33:29 +0300
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>, Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=oVborOrv6sF1qWewRUmCF/JFKm48zwCfCAMSLlRnau0=; b=sKW9Ub2u3iMWFwD5ySt4GMkyGi/7hws1icU5zJoDfGaUOBbkC+lNnspaOXeNHW6Xps xMiJkfvHJYG4JnkchsSpaoay1fVfLRwxE6mN3ky3syrA6Wim+afwT2gIl12tjaXH0jNu ymgXyG/Q5gHrahyIkG7G4mYV5r59h+o+h7rEM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=cw1AhabBzBAE9w64Rphy+XfmNVEAg83nn1XoRXvmTxqI+RjdLQpoFhynYFCZRPGrgr CSVJ++yfKIC2Dj7qvOezwBkcJ5HcC2s2UxDk5A5cosBnK+m8jXUnjslZH3ZWrzUpHFVa MzxADZNE3azUF7TK0vtxLFlUo86cgZ4STwO4E=
Sender: linux-mips-bounce@linux-mips.org
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
---
 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 041fc1a..a969eb8 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -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;
        }
 }
 
-- 
1.7.2.2


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] arch: mips: use newly introduced hex_to_bin(), Andy Shevchenko <=