Commit 49957f39 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Takashi Iwai

ALSA: 6fire: don't use custom hex_to_bin()

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2ca595ab
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/bitrev.h> #include <linux/bitrev.h>
#include <linux/kernel.h>
#include "firmware.h" #include "firmware.h"
#include "chip.h" #include "chip.h"
...@@ -59,21 +60,19 @@ struct ihex_record { ...@@ -59,21 +60,19 @@ struct ihex_record {
unsigned int txt_offset; /* current position in txt_data */ 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) static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc)
{ {
u8 val = (usb6fire_fw_ihex_nibble(data[0]) << 4) | u8 val = 0;
usb6fire_fw_ihex_nibble(data[1]); 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; *crc += val;
return val; return val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment