summaryrefslogtreecommitdiff
path: root/drivers/net/ksz884x.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2010-07-23 07:18:07 +0400
committerDavid S. Miller <davem@davemloft.net>2010-07-23 23:50:50 +0400
commit5c4ac8c60aba4b2e9549d139586612855b0fea09 (patch)
tree67d3c357fc2a51403e9485b2d4c027bde70e274d /drivers/net/ksz884x.c
parent2b27822ff8f257f810761c3d23e8104d1404cf3b (diff)
downloadlinux-5c4ac8c60aba4b2e9549d139586612855b0fea09.tar.xz
drivers: net: use newly introduced hex_to_bin()
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ksz884x.c')
-rw-r--r--drivers/net/ksz884x.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index b3c010b85658..8b32cc107f0f 100644
--- a/drivers/net/ksz884x.c
+++ b/drivers/net/ksz884x.c
@@ -6894,13 +6894,12 @@ static void get_mac_addr(struct dev_info *hw_priv, u8 *macaddr, int port)
i = j = num = got_num = 0;
while (j < MAC_ADDR_LEN) {
if (macaddr[i]) {
+ int digit;
+
got_num = 1;
- if ('0' <= macaddr[i] && macaddr[i] <= '9')
- num = num * 16 + macaddr[i] - '0';
- else if ('A' <= macaddr[i] && macaddr[i] <= 'F')
- num = num * 16 + 10 + macaddr[i] - 'A';
- else if ('a' <= macaddr[i] && macaddr[i] <= 'f')
- num = num * 16 + 10 + macaddr[i] - 'a';
+ digit = hex_to_bin(macaddr[i]);
+ if (digit >= 0)
+ num = num * 16 + digit;
else if (':' == macaddr[i])
got_num = 2;
else