aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2011-11-28 03:44:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-29 06:59:50 -0500
commitbda63586bc5929e97288cdb371bb6456504867ed (patch)
tree3e3bf8635b430858b44e43dd8b8c8cfd682fe8c5
parentc56935bdc0a8edf50237d3b0205133a5b0adc604 (diff)
firmware: Sigma: Fix endianess issues
Currently the SigmaDSP firmware loader only works correctly on little-endian systems. Fix this by using the proper endianess conversion functions. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
-rw-r--r--drivers/firmware/sigma.c2
-rw-r--r--include/linux/sigma.h8
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/firmware/sigma.c b/drivers/firmware/sigma.c
index 36265de0a9e8..1eedb6f7fdab 100644
--- a/drivers/firmware/sigma.c
+++ b/drivers/firmware/sigma.c
@@ -133,7 +133,7 @@ int process_sigma_firmware(struct i2c_client *client, const char *name)
133 crc = crc32(0, fw->data + sizeof(*ssfw_head), 133 crc = crc32(0, fw->data + sizeof(*ssfw_head),
134 fw->size - sizeof(*ssfw_head)); 134 fw->size - sizeof(*ssfw_head));
135 pr_debug("%s: crc=%x\n", __func__, crc); 135 pr_debug("%s: crc=%x\n", __func__, crc);
136 if (crc != ssfw_head->crc) 136 if (crc != le32_to_cpu(ssfw_head->crc))
137 goto done; 137 goto done;
138 138
139 ssfw.pos = sizeof(*ssfw_head); 139 ssfw.pos = sizeof(*ssfw_head);
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
index 9a138c2946bb..d0de882c0d96 100644
--- a/include/linux/sigma.h
+++ b/include/linux/sigma.h
@@ -24,7 +24,7 @@ struct sigma_firmware {
24struct sigma_firmware_header { 24struct sigma_firmware_header {
25 unsigned char magic[7]; 25 unsigned char magic[7];
26 u8 version; 26 u8 version;
27 u32 crc; 27 __le32 crc;
28}; 28};
29 29
30enum { 30enum {
@@ -40,14 +40,14 @@ enum {
40struct sigma_action { 40struct sigma_action {
41 u8 instr; 41 u8 instr;
42 u8 len_hi; 42 u8 len_hi;
43 u16 len; 43 __le16 len;
44 u16 addr; 44 __be16 addr;
45 unsigned char payload[]; 45 unsigned char payload[];
46}; 46};
47 47
48static inline u32 sigma_action_len(struct sigma_action *sa) 48static inline u32 sigma_action_len(struct sigma_action *sa)
49{ 49{
50 return (sa->len_hi << 16) | sa->len; 50 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
51} 51}
52 52
53extern int process_sigma_firmware(struct i2c_client *client, const char *name); 53extern int process_sigma_firmware(struct i2c_client *client, const char *name);