aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2011-09-23 07:32:11 -0400
committerTakashi Iwai <tiwai@suse.de>2011-09-23 09:18:52 -0400
commit49957f39665d50343e04effc65c78919364228ce (patch)
tree27ceeaf3deb336d42fa17f7b31bfd1241fe3761b /sound/usb
parent2ca595ab7a557f6cee21bf073fe2a242004cd19e (diff)
ALSA: 6fire: don't use custom hex_to_bin()
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/6fire/firmware.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
index 1e3ae3327dd3..07bcfe4d18a7 100644
--- a/sound/usb/6fire/firmware.c
+++ b/sound/usb/6fire/firmware.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/firmware.h> 17#include <linux/firmware.h>
18#include <linux/bitrev.h> 18#include <linux/bitrev.h>
19#include <linux/kernel.h>
19 20
20#include "firmware.h" 21#include "firmware.h"
21#include "chip.h" 22#include "chip.h"
@@ -59,21 +60,19 @@ struct ihex_record {
59 unsigned int txt_offset; /* current position in txt_data */ 60 unsigned int txt_offset; /* current position in txt_data */
60}; 61};
61 62
62static u8 usb6fire_fw_ihex_nibble(const u8 n)
63{
64 if (n >= '0' && n <= '9')
65 return n - '0';
66 else if (n >= 'A' && n <= 'F')
67 return n - ('A' - 10);
68 else if (n >= 'a' && n <= 'f')
69 return n - ('a' - 10);
70 return 0;
71}
72
73static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc) 63static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc)
74{ 64{
75 u8 val = (usb6fire_fw_ihex_nibble(data[0]) << 4) | 65 u8 val = 0;
76 usb6fire_fw_ihex_nibble(data[1]); 66 int hval;
67
68 hval = hex_to_bin(data[0]);
69 if (hval >= 0)
70 val |= (hval << 4);
71
72 hval = hex_to_bin(data[1]);
73 if (hval >= 0)
74 val |= hval;
75
77 *crc += val; 76 *crc += val;
78 return val; 77 return val;
79} 78}