netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH 2/5] drivers: net: use newly introduced hex_to_bin()
Date: Fri, 23 Jul 2010 16:18:07 +0300	[thread overview]
Message-ID: <3f9b9040fd8614141d4d7df59fbccf32d50e997d.1279890832.git.andy.shevchenko@gmail.com> (raw)
In-Reply-To: <cover.1279890832.git.andy.shevchenko@gmail.com>
In-Reply-To: <cover.1279890832.git.andy.shevchenko@gmail.com>

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/net/ksz884x.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index 1d998e1..37504a3 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
-- 
1.7.1.1

  parent reply	other threads:[~2010-07-23 13:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 13:18 [PATCH 0/5] remove custom implementation of hex_to_bin() Andy Shevchenko
2010-07-23 13:18 ` [PATCH 1/5] drivers: atm: don't use private copy " Andy Shevchenko
2010-07-23 19:51   ` David Miller
2010-07-23 13:18 ` Andy Shevchenko [this message]
2010-07-23 19:51   ` [PATCH 2/5] drivers: net: use newly introduced hex_to_bin() David Miller
2010-07-23 13:18 ` [PATCH 3/5] usb: usbnet: " Andy Shevchenko
2010-07-23 19:51   ` David Miller
2010-07-23 13:18 ` [PATCH 4/5] wireless: " Andy Shevchenko
2010-07-26 18:27   ` John W. Linville
2010-07-23 13:18 ` [PATCH 5/5] net: core: don't use own hex_to_bin() method Andy Shevchenko
2010-07-23 19:51   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f9b9040fd8614141d4d7df59fbccf32d50e997d.1279890832.git.andy.shevchenko@gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).