aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPontus Fuchs <pontus.fuchs@gmail.com>2012-11-05 15:17:50 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-11-14 14:55:40 -0500
commitd01a303e68310695b6d08327454f4ad76a48716f (patch)
tree37468bef365434aa65ad1ee91e66ea68b0341181 /drivers
parentf3ec3bf527638b8efb576d1bdbaf8d66d1183f92 (diff)
ar5523: Fix sparse endianness warnings
__be32 variables where used a little careless leading to sparse warnings. Treat them a little more gentle. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ar5523/ar5523.c43
-rw-r--r--drivers/net/wireless/ath/ar5523/ar5523_hw.h2
2 files changed, 24 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index 402e6d378b2..4bd7714cd66 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -50,18 +50,19 @@ static void ar5523_read_reply(struct ar5523 *ar, struct ar5523_cmd_hdr *hdr,
50 struct ar5523_tx_cmd *cmd) 50 struct ar5523_tx_cmd *cmd)
51{ 51{
52 int dlen, olen; 52 int dlen, olen;
53 u32 *rp; 53 __be32 *rp;
54 54
55 dlen = hdr->len - sizeof(*hdr); 55 dlen = be32_to_cpu(hdr->len) - sizeof(*hdr);
56 56
57 if (dlen < 0) { 57 if (dlen < 0) {
58 WARN_ON(1); 58 WARN_ON(1);
59 goto out; 59 goto out;
60 } 60 }
61 61
62 ar5523_dbg(ar, "Code = %d len = %d\n", hdr->code & 0xff, dlen); 62 ar5523_dbg(ar, "Code = %d len = %d\n", be32_to_cpu(hdr->code) & 0xff,
63 dlen);
63 64
64 rp = (u32 *)(hdr + 1); 65 rp = (__be32 *)(hdr + 1);
65 if (dlen >= sizeof(u32)) { 66 if (dlen >= sizeof(u32)) {
66 olen = be32_to_cpu(rp[0]); 67 olen = be32_to_cpu(rp[0]);
67 dlen -= sizeof(u32); 68 dlen -= sizeof(u32);
@@ -95,6 +96,7 @@ static void ar5523_cmd_rx_cb(struct urb *urb)
95 struct ar5523_tx_cmd *cmd = &ar->tx_cmd; 96 struct ar5523_tx_cmd *cmd = &ar->tx_cmd;
96 struct ar5523_cmd_hdr *hdr = ar->rx_cmd_buf; 97 struct ar5523_cmd_hdr *hdr = ar->rx_cmd_buf;
97 int dlen; 98 int dlen;
99 u32 code, hdrlen;
98 100
99 if (urb->status) { 101 if (urb->status) {
100 if (urb->status != -ESHUTDOWN) 102 if (urb->status != -ESHUTDOWN)
@@ -110,15 +112,15 @@ static void ar5523_cmd_rx_cb(struct urb *urb)
110 ar5523_dbg(ar, "%s code %02x priv %d\n", __func__, 112 ar5523_dbg(ar, "%s code %02x priv %d\n", __func__,
111 be32_to_cpu(hdr->code) & 0xff, hdr->priv); 113 be32_to_cpu(hdr->code) & 0xff, hdr->priv);
112 114
113 hdr->code = be32_to_cpu(hdr->code); 115 code = be32_to_cpu(hdr->code);
114 hdr->len = be32_to_cpu(hdr->len); 116 hdrlen = be32_to_cpu(hdr->len);
115 117
116 switch (hdr->code & 0xff) { 118 switch (code & 0xff) {
117 default: 119 default:
118 /* reply to a read command */ 120 /* reply to a read command */
119 if (hdr->priv != AR5523_CMD_ID) { 121 if (hdr->priv != AR5523_CMD_ID) {
120 ar5523_err(ar, "Unexpected command id: %02x\n", 122 ar5523_err(ar, "Unexpected command id: %02x\n",
121 hdr->code & 0xff); 123 code & 0xff);
122 goto skip; 124 goto skip;
123 } 125 }
124 ar5523_read_reply(ar, hdr, cmd); 126 ar5523_read_reply(ar, hdr, cmd);
@@ -147,7 +149,7 @@ static void ar5523_cmd_rx_cb(struct urb *urb)
147 case WDCMSG_TARGET_START: 149 case WDCMSG_TARGET_START:
148 /* This command returns a bogus id so it needs special 150 /* This command returns a bogus id so it needs special
149 handling */ 151 handling */
150 dlen = hdr->len - sizeof(*hdr); 152 dlen = hdrlen - sizeof(*hdr);
151 if (dlen != (int)sizeof(u32)) { 153 if (dlen != (int)sizeof(u32)) {
152 ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); 154 ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START");
153 return; 155 return;
@@ -303,7 +305,7 @@ static int ar5523_config(struct ar5523 *ar, u32 reg, u32 val)
303 305
304 write.reg = cpu_to_be32(reg); 306 write.reg = cpu_to_be32(reg);
305 write.len = cpu_to_be32(0); /* 0 = single write */ 307 write.len = cpu_to_be32(0); /* 0 = single write */
306 *(u32 *)write.data = cpu_to_be32(val); 308 *(__be32 *)write.data = cpu_to_be32(val);
307 309
308 error = ar5523_cmd_write(ar, WDCMSG_TARGET_SET_CONFIG, &write, 310 error = ar5523_cmd_write(ar, WDCMSG_TARGET_SET_CONFIG, &write,
309 3 * sizeof(u32), 0); 311 3 * sizeof(u32), 0);
@@ -335,29 +337,30 @@ static int ar5523_get_status(struct ar5523 *ar, u32 which, void *odata,
335 int olen) 337 int olen)
336{ 338{
337 int error; 339 int error;
340 __be32 which_be;
338 341
339 which = cpu_to_be32(which); 342 which_be = cpu_to_be32(which);
340 error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_STATUS, 343 error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_STATUS,
341 &which, sizeof(which), odata, olen, AR5523_CMD_FLAG_MAGIC); 344 &which_be, sizeof(which_be), odata, olen, AR5523_CMD_FLAG_MAGIC);
342 if (error != 0) 345 if (error != 0)
343 ar5523_err(ar, "could not read EEPROM offset 0x%02x\n", 346 ar5523_err(ar, "could not read EEPROM offset 0x%02x\n", which);
344 be32_to_cpu(which));
345 return error; 347 return error;
346} 348}
347 349
348static int ar5523_get_capability(struct ar5523 *ar, u32 cap, u32 *val) 350static int ar5523_get_capability(struct ar5523 *ar, u32 cap, u32 *val)
349{ 351{
350 int error; 352 int error;
353 __be32 cap_be, val_be;
351 354
352 cap = cpu_to_be32(cap); 355 cap_be = cpu_to_be32(cap);
353 error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_CAPABILITY, 356 error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_CAPABILITY, &cap_be,
354 &cap, sizeof(cap), val, sizeof(u32), AR5523_CMD_FLAG_MAGIC); 357 sizeof(cap_be), &val_be, sizeof(__be32),
358 AR5523_CMD_FLAG_MAGIC);
355 if (error != 0) { 359 if (error != 0) {
356 ar5523_err(ar, "could not read capability %u\n", 360 ar5523_err(ar, "could not read capability %u\n", cap);
357 be32_to_cpu(cap));
358 return error; 361 return error;
359 } 362 }
360 *val = be32_to_cpu(*val); 363 *val = be32_to_cpu(val_be);
361 return error; 364 return error;
362} 365}
363 366
diff --git a/drivers/net/wireless/ath/ar5523/ar5523_hw.h b/drivers/net/wireless/ath/ar5523/ar5523_hw.h
index a0e8bf46031..0fe2c803f48 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523_hw.h
+++ b/drivers/net/wireless/ath/ar5523/ar5523_hw.h
@@ -161,7 +161,7 @@ struct ar5523_rx_desc {
161 161
162struct ar5523_tx_desc { 162struct ar5523_tx_desc {
163 __be32 msglen; 163 __be32 msglen;
164 __be32 msgid; /* msg id (supplied by host) */ 164 u32 msgid; /* msg id (supplied by host) */
165 __be32 type; /* opcode: WDMSG_SEND or WDCMSG_FLUSH */ 165 __be32 type; /* opcode: WDMSG_SEND or WDCMSG_FLUSH */
166 __be32 txqid; /* tx queue id and flags */ 166 __be32 txqid; /* tx queue id and flags */
167#define UATH_TXQID_MASK 0x0f 167#define UATH_TXQID_MASK 0x0f