[PATCH 04/10] drivers: net: use new hex_to_bin() method

From: Andy Shevchenko
Date: Fri Apr 30 2010 - 14:21:37 EST


Instead of using own implementation involve hex_to_bin() function. It requires
to have hex_to_bin() introduced by starter patch in series.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
drivers/net/sb1250-mac.c | 32 ++------------------------------
1 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 9944e5d..34f8753 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2184,34 +2184,6 @@ static void sbmac_setmulti(struct sbmac_softc *sc)

#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR)
/**********************************************************************
- * SBMAC_PARSE_XDIGIT(str)
- *
- * Parse a hex digit, returning its value
- *
- * Input parameters:
- * str - character
- *
- * Return value:
- * hex value, or -1 if invalid
- ********************************************************************* */
-
-static int sbmac_parse_xdigit(char str)
-{
- int digit;
-
- if ((str >= '0') && (str <= '9'))
- digit = str - '0';
- else if ((str >= 'a') && (str <= 'f'))
- digit = str - 'a' + 10;
- else if ((str >= 'A') && (str <= 'F'))
- digit = str - 'A' + 10;
- else
- return -1;
-
- return digit;
-}
-
-/**********************************************************************
* SBMAC_PARSE_HWADDR(str,hwaddr)
*
* Convert a string in the form xx:xx:xx:xx:xx:xx into a 6-byte
@@ -2231,7 +2203,7 @@ static int sbmac_parse_hwaddr(char *str, unsigned char *hwaddr)
int idx = 6;

while (*str && (idx > 0)) {
- digit1 = sbmac_parse_xdigit(*str);
+ digit1 = hex_to_bin(*str);
if (digit1 < 0)
return -1;
str++;
@@ -2243,7 +2215,7 @@ static int sbmac_parse_hwaddr(char *str, unsigned char *hwaddr)
digit1 = 0;
}
else {
- digit2 = sbmac_parse_xdigit(*str);
+ digit2 = hex_to_bin(*str);
if (digit2 < 0)
return -1;
str++;
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/