From: Andy Shevchenko Date: Fri, 23 Jul 2010 03:18:07 +0000 (+0000) Subject: drivers: net: use newly introduced hex_to_bin() X-Git-Tag: upstream/snapshot3+hdmi~13787^2~115 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c4ac8c60aba4b2e9549d139586612855b0fea09;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git drivers: net: use newly introduced hex_to_bin() Signed-off-by: Andy Shevchenko Signed-off-by: David S. Miller --- diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c index b3c010b..8b32cc1 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