diff options
Diffstat (limited to 'sound/usb/6fire/firmware.c')
-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 @@ | |||
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 | ||
62 | static 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 | |||
73 | static u8 usb6fire_fw_ihex_hex(const u8 *data, u8 *crc) | 63 | static 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 | } |