Skip to contentSkip to conversation

alsa: riptide: don't use own hex_to_bin() method

PATCH In review Andy Shevchenko 2 participants 2 messages Jun 15, 2010 – Jun 17, 2010 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsa: riptide: don't use own hex_to_bin() method

From: Andy Shevchenko <[email protected]>

---
 sound/pci/riptide/riptide.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
sound/pci/riptide/riptide.c +6 -6
index ad44626..59d7996 100644
@@ -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;
 	}
Signature · 1 line
1.6.6.1
#1 lore raw

At Tue, 15 Jun 2010 17:26:28 +0300,

Quoted 7 lines · Andy Shevchenko

From: Andy Shevchenko <[email protected]>

Applied now. Thanks.

Takashi

Quoted 38 lines
---
 sound/pci/riptide/riptide.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
sound/pci/riptide/riptide.c +6 -6
index ad44626..59d7996 100644
@@ -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;
 	}
Signature · 1 line
1.6.6.1