mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers: s390: remove custom implementation of hex_to_bin()
@ 2010-09-11 13:36 Andy Shevchenko
  2010-09-13  8:04 ` Heiko Carstens
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2010-09-11 13:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andy Shevchenko, Martin Schwidefsky, Heiko Carstens, linux390,
	linux-s390

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
 drivers/s390/cio/blacklist.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index 13cb601..76058a5 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -79,17 +79,15 @@ static int pure_hex(char **cp, unsigned int *val, int min_digit,
 		    int max_digit, int max_val)
 {
 	int diff;
-	unsigned int value;
 
 	diff = 0;
 	*val = 0;
 
-	while (isxdigit(**cp) && (diff <= max_digit)) {
+	while (diff <= max_digit) {
+		int value = hex_to_bin(**cp);
 
-		if (isdigit(**cp))
-			value = **cp - '0';
-		else
-			value = tolower(**cp) - 'a' + 10;
+		if (value < 0)
+			break;
 		*val = *val * 16 + value;
 		(*cp)++;
 		diff++;
-- 
1.7.2.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: s390: remove custom implementation of hex_to_bin()
  2010-09-11 13:36 [PATCH] drivers: s390: remove custom implementation of hex_to_bin() Andy Shevchenko
@ 2010-09-13  8:04 ` Heiko Carstens
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2010-09-13  8:04 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Martin Schwidefsky, linux390, linux-s390

On Sat, Sep 11, 2010 at 04:36:38PM +0300, Andy Shevchenko wrote:
> diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
> index 13cb601..76058a5 100644
> --- a/drivers/s390/cio/blacklist.c
> +++ b/drivers/s390/cio/blacklist.c
> @@ -79,17 +79,15 @@ static int pure_hex(char **cp, unsigned int *val, int min_digit,
>  		    int max_digit, int max_val)
>  {
>  	int diff;
> -	unsigned int value;
> 
>  	diff = 0;
>  	*val = 0;
> 
> -	while (isxdigit(**cp) && (diff <= max_digit)) {
> +	while (diff <= max_digit) {
> +		int value = hex_to_bin(**cp);
> 
> -		if (isdigit(**cp))
> -			value = **cp - '0';
> -		else
> -			value = tolower(**cp) - 'a' + 10;
> +		if (value < 0)
> +			break;
>  		*val = *val * 16 + value;
>  		(*cp)++;
>  		diff++;

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-13  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-11 13:36 [PATCH] drivers: s390: remove custom implementation of hex_to_bin() Andy Shevchenko
2010-09-13  8:04 ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®