All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alsa: riptide: don't use own hex_to_bin() method
@ 2010-06-15 14:26 ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2010-06-15 14:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andy Shevchenko, Jaroslav Kysela, Takashi Iwai, alsa-devel

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

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
---
 sound/pci/riptide/riptide.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ad44626..59d7996 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -97,6 +97,7 @@
 #include <linux/gameport.h>
 #include <linux/device.h>
 #include <linux/firmware.h>
+#include <linux/kernel.h>
 #include <asm/io.h>
 #include <sound/core.h>
 #include <sound/info.h>
@@ -667,13 +668,12 @@ static u32 atoh(const unsigned char *in, unsigned int len)
 	unsigned char c;
 
 	while (len) {
+		int value;
+
 		c = in[len - 1];
-		if ((c >= '0') && (c <= '9'))
-			sum += mult * (c - '0');
-		else if ((c >= 'A') && (c <= 'F'))
-			sum += mult * (c - ('A' - 10));
-		else if ((c >= 'a') && (c <= 'f'))
-			sum += mult * (c - ('a' - 10));
+		value = hex_to_bin(c);
+		if (value >= 0)
+			sum += mult * value;
 		mult *= 16;
 		--len;
 	}
-- 
1.6.6.1


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

* [PATCH] alsa: riptide: don't use own hex_to_bin() method
@ 2010-06-15 14:26 ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2010-06-15 14:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: Takashi Iwai, alsa-devel, Andy Shevchenko

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

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
---
 sound/pci/riptide/riptide.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ad44626..59d7996 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -97,6 +97,7 @@
 #include <linux/gameport.h>
 #include <linux/device.h>
 #include <linux/firmware.h>
+#include <linux/kernel.h>
 #include <asm/io.h>
 #include <sound/core.h>
 #include <sound/info.h>
@@ -667,13 +668,12 @@ static u32 atoh(const unsigned char *in, unsigned int len)
 	unsigned char c;
 
 	while (len) {
+		int value;
+
 		c = in[len - 1];
-		if ((c >= '0') && (c <= '9'))
-			sum += mult * (c - '0');
-		else if ((c >= 'A') && (c <= 'F'))
-			sum += mult * (c - ('A' - 10));
-		else if ((c >= 'a') && (c <= 'f'))
-			sum += mult * (c - ('a' - 10));
+		value = hex_to_bin(c);
+		if (value >= 0)
+			sum += mult * value;
 		mult *= 16;
 		--len;
 	}
-- 
1.6.6.1

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

* Re: [PATCH] alsa: riptide: don't use own hex_to_bin() method
  2010-06-15 14:26 ` Andy Shevchenko
@ 2010-06-17  7:43   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2010-06-17  7:43 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-kernel, Andy Shevchenko, Jaroslav Kysela, alsa-devel

At Tue, 15 Jun 2010 17:26:28 +0300,
Andy Shevchenko wrote:
> 
> From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org

Applied now.  Thanks.


Takashi

> ---
>  sound/pci/riptide/riptide.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index ad44626..59d7996 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -97,6 +97,7 @@
>  #include <linux/gameport.h>
>  #include <linux/device.h>
>  #include <linux/firmware.h>
> +#include <linux/kernel.h>
>  #include <asm/io.h>
>  #include <sound/core.h>
>  #include <sound/info.h>
> @@ -667,13 +668,12 @@ static u32 atoh(const unsigned char *in, unsigned int len)
>  	unsigned char c;
>  
>  	while (len) {
> +		int value;
> +
>  		c = in[len - 1];
> -		if ((c >= '0') && (c <= '9'))
> -			sum += mult * (c - '0');
> -		else if ((c >= 'A') && (c <= 'F'))
> -			sum += mult * (c - ('A' - 10));
> -		else if ((c >= 'a') && (c <= 'f'))
> -			sum += mult * (c - ('a' - 10));
> +		value = hex_to_bin(c);
> +		if (value >= 0)
> +			sum += mult * value;
>  		mult *= 16;
>  		--len;
>  	}
> -- 
> 1.6.6.1
> 

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

* Re: [PATCH] alsa: riptide: don't use own hex_to_bin() method
@ 2010-06-17  7:43   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2010-06-17  7:43 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: alsa-devel, linux-kernel, Andy Shevchenko

At Tue, 15 Jun 2010 17:26:28 +0300,
Andy Shevchenko wrote:
> 
> From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org

Applied now.  Thanks.


Takashi

> ---
>  sound/pci/riptide/riptide.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index ad44626..59d7996 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -97,6 +97,7 @@
>  #include <linux/gameport.h>
>  #include <linux/device.h>
>  #include <linux/firmware.h>
> +#include <linux/kernel.h>
>  #include <asm/io.h>
>  #include <sound/core.h>
>  #include <sound/info.h>
> @@ -667,13 +668,12 @@ static u32 atoh(const unsigned char *in, unsigned int len)
>  	unsigned char c;
>  
>  	while (len) {
> +		int value;
> +
>  		c = in[len - 1];
> -		if ((c >= '0') && (c <= '9'))
> -			sum += mult * (c - '0');
> -		else if ((c >= 'A') && (c <= 'F'))
> -			sum += mult * (c - ('A' - 10));
> -		else if ((c >= 'a') && (c <= 'f'))
> -			sum += mult * (c - ('a' - 10));
> +		value = hex_to_bin(c);
> +		if (value >= 0)
> +			sum += mult * value;
>  		mult *= 16;
>  		--len;
>  	}
> -- 
> 1.6.6.1
> 

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

end of thread, other threads:[~2010-06-17  7:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-15 14:26 [PATCH] alsa: riptide: don't use own hex_to_bin() method Andy Shevchenko
2010-06-15 14:26 ` Andy Shevchenko
2010-06-17  7:43 ` Takashi Iwai
2010-06-17  7:43   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.