mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Subject: [PATCH 10/12] drivers: net: use new hex_to_bin() method
Date: Thu, 18 Feb 2010 20:55:49 +0200	[thread overview]
Message-ID: <1266519351-3218-11-git-send-email-andy.shevchenko@gmail.com> (raw)
In-Reply-To: <1266519351-3218-10-git-send-email-andy.shevchenko@gmail.com>

From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Get rid of own implementation of hex_to_bin(). It requires to have hex_to_bin()
introduced by one of previous path in series.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 drivers/net/cxgb3/t3_hw.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 032cfe0..80b3cd7 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -679,14 +679,6 @@ int t3_seeprom_wp(struct adapter *adapter, int enable)
 	return t3_seeprom_write(adapter, EEPROM_STAT_ADDR, enable ? 0xc : 0);
 }
 
-/*
- * Convert a character holding a hex digit to a number.
- */
-static unsigned int hex2int(unsigned char c)
-{
-	return isdigit(c) ? c - '0' : toupper(c) - 'A' + 10;
-}
-
 /**
  *	get_vpd_params - read VPD parameters from VPD EEPROM
  *	@adapter: adapter to read
@@ -727,15 +719,15 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
 		p->port_type[0] = uses_xaui(adapter) ? 1 : 2;
 		p->port_type[1] = uses_xaui(adapter) ? 6 : 2;
 	} else {
-		p->port_type[0] = hex2int(vpd.port0_data[0]);
-		p->port_type[1] = hex2int(vpd.port1_data[0]);
+		p->port_type[0] = hex_to_bin(vpd.port0_data[0]);
+		p->port_type[1] = hex_to_bin(vpd.port1_data[0]);
 		p->xauicfg[0] = simple_strtoul(vpd.xaui0cfg_data, NULL, 16);
 		p->xauicfg[1] = simple_strtoul(vpd.xaui1cfg_data, NULL, 16);
 	}
 
 	for (i = 0; i < 6; i++)
-		p->eth_base[i] = hex2int(vpd.na_data[2 * i]) * 16 +
-				 hex2int(vpd.na_data[2 * i + 1]);
+		p->eth_base[i] = hex_to_bin(vpd.na_data[2*i]) * 16 +
+				 hex_to_bin(vpd.na_data[2*i + 1]);
 	return 0;
 }
 
-- 
1.5.6.5


  reply	other threads:[~2010-02-18 18:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 18:55 [PATCH 00/12] Clean up code to use native kernel functions when convert or check hex digits Andy Shevchenko
2010-02-18 18:55 ` [PATCH 01/12] isdn: remove ishexdigit() in regard to isxdigit() Andy Shevchenko
2010-02-18 18:55   ` [PATCH 02/12] audit: use kernel's method to get byte in hex form Andy Shevchenko
2010-02-18 18:55     ` [PATCH 03/12] staging: remove unused methods Andy Shevchenko
2010-02-18 18:55       ` [PATCH 04/12] scsi: ibmmca: use kernel native convertor Andy Shevchenko
2010-02-18 18:55         ` [PATCH 05/12] lib: introduce common method to convert hex digits Andy Shevchenko
2010-02-18 18:55           ` [PATCH 06/12] drivers: net: optimize hex2bin() Andy Shevchenko
2010-02-18 18:55             ` [PATCH 07/12] usb: atm: speedtch: use new hex_to_bin() method Andy Shevchenko
2010-02-18 18:55               ` [PATCH 08/12] net: " Andy Shevchenko
2010-02-18 18:55                 ` [PATCH 09/12] drivers: net: use kernel's method to get byte in hex form Andy Shevchenko
2010-02-18 18:55                   ` Andy Shevchenko [this message]
2010-02-18 18:55                     ` [PATCH 11/12] drivers: isdn: use new hex_to_bin() method Andy Shevchenko
2010-02-18 18:55                       ` [PATCH 12/12] drivers: wireless: use kernel's method to get byte in hex form Andy Shevchenko
2010-02-18 23:55                       ` [PATCH 11/12] drivers: isdn: use new hex_to_bin() method Tilman Schmidt
2010-02-19  9:53                         ` [PATCHv2] " Andy Shevchenko
2010-02-19 14:53       ` [PATCH 03/12] staging: remove unused methods Greg KH
2010-02-22 20:21     ` [PATCH 02/12] audit: use kernel's method to get byte in hex form Eric Paris
2010-02-22 21:18       ` Andy Shevchenko
2010-02-18 23:36   ` [PATCH 01/12] isdn: remove ishexdigit() in regard to isxdigit() Tilman Schmidt
2010-02-19 11:41 ` [PATCH 00/12] Clean up code to use native kernel functions when convert or check hex digits Andy Shevchenko
2010-02-19 23:44   ` Tilman Schmidt

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=1266519351-3218-11-git-send-email-andy.shevchenko@gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=ext-andriy.shevchenko@nokia.com \
    --cc=linux-kernel@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

Powered by JetHome