diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2008-09-25 15:54:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-30 14:07:22 -0400 |
commit | 1f1c0e33a0ab1379272da68fe58abf586c8e96e5 (patch) | |
tree | 1c219832042d52808b117ef56efd4fe4fcbfe5ab /drivers/net/wireless/p54/p54common.c | |
parent | 3bb91bff8165223aa14f015a6c9150a536b40d9b (diff) |
p54: Fix sparse warnings
The command
make C=2 CF="-D__CHECK_ENDIAN__" drivers/net/wireless/p54/
generates the following warnings:
.../p54common.c:152:38: warning: incorrect type in argument 1 (different base types)
.../p54common.c:152:38: expected restricted __be32 const [usertype] *p
.../p54common.c:152:38: got unsigned int *<noident>
.../p54common.c:184:15: warning: restricted __le32 degrades to integer
.../p54common.c:185:29: warning: cast to restricted __le16
.../p54common.c:309:11: warning: symbol 'p54_rf_chips' was not declared.
Should it be static?
.../p54common.c:313:5: warning: symbol 'p54_parse_eeprom' was not declared.
Should it be static?
.../p54common.c:620:43: warning: incorrect type in argument 3 (different base types)
.../p54common.c:620:43: expected unsigned long [unsigned] [usertype] len
.../p54common.c:620:43: got restricted __le16 [usertype] len
.../p54common.c:780:41: warning: restricted __le16 degrades to integer
.../p54common.c:781:32: warning: restricted __le16 degrades to integer
.../p54common.c:1250:28: warning: incorrect type in argument 2 (different base types)
.../p54common.c:1250:28: expected unsigned short [unsigned] [usertype] filter_type
.../p54common.c:1250:28: got restricted __le16 [usertype] filter_type
.../p54common.c:1252:28: warning: incorrect type in argument 2 (different base types)
.../p54common.c:1252:28: expected unsigned short [unsigned] [usertype] filter_type
.../p54common.c:1252:28: got restricted __le16 [usertype] filter_type
.../p54common.c:1257:42: warning: incorrect type in argument 2 (different base types)
.../p54common.c:1257:42: expected unsigned short [unsigned] [usertype] filter_type
.../p54common.c:1257:42: got restricted __le16
.../p54common.c:1260:42: warning: incorrect type in argument 2 (different base types)
.../p54common.c:1260:42: expected unsigned short [unsigned] [usertype] filter_type
.../p54common.c:1260:42: got restricted __le16
.../p54usb.c:228:10: warning: restricted __le32 degrades to integer
.../p54usb.c:228:23: warning: restricted __le32 degrades to integer
.../p54usb.c:228:7: warning: incorrect type in assignment (different base types)
.../p54usb.c:228:7: expected restricted __le32 [assigned] [usertype] chk
.../p54usb.c:228:7: got unsigned int
.../p54usb.c:221:8: warning: symbol 'p54u_lm87_chksum' was not declared.
Should it be static?
All of the above have been fixed. One question, however, remains: In struct
bootrec, the array "data" is treated in many places as native CPU order, but
it may be little-endian everywhere. As far as I can tell, this driver has only
been used with little-endian hardware.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index bac58ed03e5c..de5e8f44b202 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -149,7 +149,8 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
149 | u32 code = le32_to_cpu(bootrec->code); | 149 | u32 code = le32_to_cpu(bootrec->code); |
150 | switch (code) { | 150 | switch (code) { |
151 | case BR_CODE_COMPONENT_ID: | 151 | case BR_CODE_COMPONENT_ID: |
152 | priv->fw_interface = be32_to_cpup(bootrec->data); | 152 | priv->fw_interface = be32_to_cpup((__be32 *) |
153 | bootrec->data); | ||
153 | switch (priv->fw_interface) { | 154 | switch (priv->fw_interface) { |
154 | case FW_FMAC: | 155 | case FW_FMAC: |
155 | printk(KERN_INFO "p54: FreeMAC firmware\n"); | 156 | printk(KERN_INFO "p54: FreeMAC firmware\n"); |
@@ -181,9 +182,8 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
181 | priv->rx_end = le32_to_cpu(desc->rx_end) - 0x3500; | 182 | priv->rx_end = le32_to_cpu(desc->rx_end) - 0x3500; |
182 | priv->headroom = desc->headroom; | 183 | priv->headroom = desc->headroom; |
183 | priv->tailroom = desc->tailroom; | 184 | priv->tailroom = desc->tailroom; |
184 | if (bootrec->len == 11) | 185 | if (le32_to_cpu(bootrec->len) == 11) |
185 | priv->rx_mtu = (size_t) le16_to_cpu( | 186 | priv->rx_mtu = le16_to_cpu(bootrec->rx_mtu); |
186 | (__le16)bootrec->data[10]); | ||
187 | else | 187 | else |
188 | priv->rx_mtu = (size_t) | 188 | priv->rx_mtu = (size_t) |
189 | 0x620 - priv->tx_hdr_len; | 189 | 0x620 - priv->tx_hdr_len; |
@@ -306,11 +306,11 @@ static int p54_convert_rev1(struct ieee80211_hw *dev, | |||
306 | return 0; | 306 | return 0; |
307 | } | 307 | } |
308 | 308 | ||
309 | const char* p54_rf_chips[] = { "NULL", "Indigo?", "Duette", | 309 | static const char *p54_rf_chips[] = { "NULL", "Indigo?", "Duette", |
310 | "Frisbee", "Xbow", "Longbow" }; | 310 | "Frisbee", "Xbow", "Longbow" }; |
311 | static int p54_init_xbow_synth(struct ieee80211_hw *dev); | 311 | static int p54_init_xbow_synth(struct ieee80211_hw *dev); |
312 | 312 | ||
313 | int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | 313 | static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) |
314 | { | 314 | { |
315 | struct p54_common *priv = dev->priv; | 315 | struct p54_common *priv = dev->priv; |
316 | struct eeprom_pda_wrap *wrap = NULL; | 316 | struct eeprom_pda_wrap *wrap = NULL; |
@@ -617,7 +617,7 @@ static void p54_rx_eeprom_readback(struct ieee80211_hw *dev, | |||
617 | if (!priv->eeprom) | 617 | if (!priv->eeprom) |
618 | return ; | 618 | return ; |
619 | 619 | ||
620 | memcpy(priv->eeprom, eeprom->data, eeprom->len); | 620 | memcpy(priv->eeprom, eeprom->data, le16_to_cpu(eeprom->len)); |
621 | 621 | ||
622 | complete(&priv->eeprom_comp); | 622 | complete(&priv->eeprom_comp); |
623 | } | 623 | } |
@@ -777,8 +777,9 @@ int p54_read_eeprom(struct ieee80211_hw *dev) | |||
777 | hdr->len = cpu_to_le16(blocksize + sizeof(*eeprom_hdr)); | 777 | hdr->len = cpu_to_le16(blocksize + sizeof(*eeprom_hdr)); |
778 | eeprom_hdr->offset = cpu_to_le16(offset); | 778 | eeprom_hdr->offset = cpu_to_le16(offset); |
779 | eeprom_hdr->len = cpu_to_le16(blocksize); | 779 | eeprom_hdr->len = cpu_to_le16(blocksize); |
780 | p54_assign_address(dev, NULL, hdr, hdr->len + sizeof(*hdr)); | 780 | p54_assign_address(dev, NULL, hdr, le16_to_cpu(hdr->len) + |
781 | priv->tx(dev, hdr, hdr->len + sizeof(*hdr), 0); | 781 | sizeof(*hdr)); |
782 | priv->tx(dev, hdr, le16_to_cpu(hdr->len) + sizeof(*hdr), 0); | ||
782 | 783 | ||
783 | if (!wait_for_completion_interruptible_timeout(&priv->eeprom_comp, HZ)) { | 784 | if (!wait_for_completion_interruptible_timeout(&priv->eeprom_comp, HZ)) { |
784 | printk(KERN_ERR "%s: device does not respond!\n", | 785 | printk(KERN_ERR "%s: device does not respond!\n", |
@@ -1247,18 +1248,20 @@ static void p54_configure_filter(struct ieee80211_hw *dev, | |||
1247 | 1248 | ||
1248 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | 1249 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
1249 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | 1250 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) |
1250 | p54_set_filter(dev, priv->filter_type, NULL); | 1251 | p54_set_filter(dev, le16_to_cpu(priv->filter_type), |
1252 | NULL); | ||
1251 | else | 1253 | else |
1252 | p54_set_filter(dev, priv->filter_type, priv->bssid); | 1254 | p54_set_filter(dev, le16_to_cpu(priv->filter_type), |
1255 | priv->bssid); | ||
1253 | } | 1256 | } |
1254 | 1257 | ||
1255 | if (changed_flags & FIF_PROMISC_IN_BSS) { | 1258 | if (changed_flags & FIF_PROMISC_IN_BSS) { |
1256 | if (*total_flags & FIF_PROMISC_IN_BSS) | 1259 | if (*total_flags & FIF_PROMISC_IN_BSS) |
1257 | p54_set_filter(dev, priv->filter_type | | 1260 | p54_set_filter(dev, le16_to_cpu(priv->filter_type) | |
1258 | cpu_to_le16(0x8), NULL); | 1261 | 0x8, NULL); |
1259 | else | 1262 | else |
1260 | p54_set_filter(dev, priv->filter_type & | 1263 | p54_set_filter(dev, le16_to_cpu(priv->filter_type) & |
1261 | ~cpu_to_le16(0x8), priv->bssid); | 1264 | ~0x8, priv->bssid); |
1262 | } | 1265 | } |
1263 | } | 1266 | } |
1264 | 1267 | ||