diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2011-09-23 14:32:11 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-09-23 15:18:52 +0200 |
commit | 49957f39665d50343e04effc65c78919364228ce (patch) | |
tree | 27ceeaf3deb336d42fa17f7b31bfd1241fe3761b | |
parent | 2ca595ab7a557f6cee21bf073fe2a242004cd19e (diff) | |
download | linux-49957f39665d50343e04effc65c78919364228ce.tar.gz linux-49957f39665d50343e04effc65c78919364228ce.tar.bz2 linux-49957f39665d50343e04effc65c78919364228ce.zip |
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>
-rw-r--r-- | sound/usb/6fire/firmware.c | 25 |
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 @@ #include <linux/firmware.h> #include <linux/bitrev.h> +#include <linux/kernel.h> #include "firmware.h" #include "chip.h" @@ -59,21 +60,19 @@ struct ihex_record { unsigned int txt_offset; /* current position in txt_data */ }; -static u8 usb6fire_fw_ihex_nibble(const u8 n) -{ - if (n >= '0' && n <= '9') - return n - '0'; - else if (n >= 'A' && n <= 'F') - return n - ('A' - 10); - else if (n >= 'a' && n <= 'f') - return n - ('a' - 10); - return 0; -} - static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc) { - u8 val = (usb6fire_fw_ihex_nibble(data[0]) << 4) | - usb6fire_fw_ihex_nibble(data[1]); + u8 val = 0; + int hval; + + hval = hex_to_bin(data[0]); + if (hval >= 0) + val |= (hval << 4); + + hval = hex_to_bin(data[1]); + if (hval >= 0) + val |= hval; + *crc += val; return val; } |