aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-12-07 10:30:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:13 -0500
commitc2df2efe96742b78454acdffe6d278ae334fc838 (patch)
tree972dc13146959e44f2d487bf1b86968f2b175076 /drivers/net/wireless/libertas
parent1723047d6742cc172d5c0f1a5245deaee67ff331 (diff)
libertas: endianness fixes
Recently I found that that sparse by default doesn't endianness checks. So I changed my compilation habit to be make modules C=1 SUBDIRS=drivers/net/wireless/libertas CHECKFLAGS="-D__CHECK_ENDIAN__" so that I get the little-endian checks from sparse as well. That showed up a good bunch of problems. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/11d.c2
-rw-r--r--drivers/net/wireless/libertas/cmd.c28
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c2
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h8
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c2
-rw-r--r--drivers/net/wireless/libertas/if_usb.c4
6 files changed, 23 insertions, 23 deletions
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index 377dcb5b8f0c..013965d40519 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -518,7 +518,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
518 cmd->size = 518 cmd->size =
519 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); 519 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
520 lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, 520 lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd,
521 (int)(cmd->size)); 521 le16_to_cpu(cmd->size));
522 goto done; 522 goto done;
523 } 523 }
524 524
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index ebfcb7bac681..cf1ab8a345fe 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -431,7 +431,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
431 u8 mode = (u8) (size_t) pdata_buf; 431 u8 mode = (u8) (size_t) pdata_buf;
432 pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); 432 pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
433 pSNMPMIB->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I); 433 pSNMPMIB->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I);
434 pSNMPMIB->bufsize = sizeof(u8); 434 pSNMPMIB->bufsize = cpu_to_le16(sizeof(u8));
435 if (mode == IW_MODE_ADHOC) { 435 if (mode == IW_MODE_ADHOC) {
436 ucTemp = SNMP_MIB_VALUE_ADHOC; 436 ucTemp = SNMP_MIB_VALUE_ADHOC;
437 } else { 437 } else {
@@ -451,8 +451,8 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
451 pSNMPMIB->oid = cpu_to_le16((u16) DOT11D_I); 451 pSNMPMIB->oid = cpu_to_le16((u16) DOT11D_I);
452 452
453 if (cmd_action == CMD_ACT_SET) { 453 if (cmd_action == CMD_ACT_SET) {
454 pSNMPMIB->querytype = CMD_ACT_SET; 454 pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
455 pSNMPMIB->bufsize = sizeof(u16); 455 pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
456 ulTemp = *(u32 *)pdata_buf; 456 ulTemp = *(u32 *)pdata_buf;
457 *((__le16 *)(pSNMPMIB->value)) = 457 *((__le16 *)(pSNMPMIB->value)) =
458 cpu_to_le16((u16) ulTemp); 458 cpu_to_le16((u16) ulTemp);
@@ -484,7 +484,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
484 { 484 {
485 485
486 u32 ulTemp; 486 u32 ulTemp;
487 pSNMPMIB->oid = le16_to_cpu((u16) RTSTHRESH_I); 487 pSNMPMIB->oid = cpu_to_le16(RTSTHRESH_I);
488 488
489 if (cmd_action == CMD_ACT_GET) { 489 if (cmd_action == CMD_ACT_GET) {
490 pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET); 490 pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
@@ -759,7 +759,7 @@ static int lbs_cmd_reg_access(struct lbs_private *priv,
759 759
760 offval = (struct lbs_offset_value *)pdata_buf; 760 offval = (struct lbs_offset_value *)pdata_buf;
761 761
762 switch (cmdptr->command) { 762 switch (le16_to_cpu(cmdptr->command)) {
763 case CMD_MAC_REG_ACCESS: 763 case CMD_MAC_REG_ACCESS:
764 { 764 {
765 struct cmd_ds_mac_reg_access *macreg; 765 struct cmd_ds_mac_reg_access *macreg;
@@ -999,7 +999,7 @@ void lbs_queue_cmd(struct lbs_adapter *adapter,
999 } 999 }
1000 1000
1001 /* Exit_PS command needs to be queued in the header always. */ 1001 /* Exit_PS command needs to be queued in the header always. */
1002 if (cmdptr->command == CMD_802_11_PS_MODE) { 1002 if (le16_to_cpu(cmdptr->command) == CMD_802_11_PS_MODE) {
1003 struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; 1003 struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode;
1004 if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { 1004 if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) {
1005 if (adapter->psstate != PS_STATE_FULL_POWER) 1005 if (adapter->psstate != PS_STATE_FULL_POWER)
@@ -1062,15 +1062,14 @@ static int DownloadcommandToStation(struct lbs_private *priv,
1062 adapter->cur_cmd_retcode = 0; 1062 adapter->cur_cmd_retcode = 0;
1063 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1063 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1064 1064
1065 cmdsize = cmdptr->size; 1065 cmdsize = le16_to_cpu(cmdptr->size);
1066 command = cpu_to_le16(cmdptr->command); 1066 command = le16_to_cpu(cmdptr->command);
1067 1067
1068 lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n", 1068 lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n",
1069 command, le16_to_cpu(cmdptr->size), jiffies); 1069 command, cmdsize, jiffies);
1070 lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", cmdnode->bufvirtualaddr, cmdsize); 1070 lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", cmdnode->bufvirtualaddr, cmdsize);
1071 1071
1072 cmdnode->cmdwaitqwoken = 0; 1072 cmdnode->cmdwaitqwoken = 0;
1073 cmdsize = cpu_to_le16(cmdsize);
1074 1073
1075 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); 1074 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
1076 1075
@@ -1426,9 +1425,10 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1426 1425
1427#define ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN 8 1426#define ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN 8
1428 cmdptr->size = 1427 cmdptr->size =
1429 cpu_to_le16(gpio->header.len + S_DS_GEN + 1428 cpu_to_le16(le16_to_cpu(gpio->header.len)
1430 ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN); 1429 + S_DS_GEN
1431 gpio->header.len = cpu_to_le16(gpio->header.len); 1430 + ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN);
1431 gpio->header.len = gpio->header.len;
1432 1432
1433 ret = 0; 1433 ret = 0;
1434 break; 1434 break;
@@ -2019,7 +2019,7 @@ static int lbs_cmd_callback(uint16_t respcmd, struct cmd_ds_command *resp, struc
2019{ 2019{
2020 struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; 2020 struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp;
2021 struct lbs_adapter *adapter = priv->adapter; 2021 struct lbs_adapter *adapter = priv->adapter;
2022 u16 sz = cpu_to_le16(resp->size) - S_DS_GEN; 2022 u16 sz = le16_to_cpu(resp->size) - S_DS_GEN;
2023 2023
2024 if (sz > *adapter->cur_cmd->pdata_size) { 2024 if (sz > *adapter->cur_cmd->pdata_size) {
2025 lbs_pr_err("response 0x%04x doesn't fit into buffer (%d > %d)\n", 2025 lbs_pr_err("response 0x%04x doesn't fit into buffer (%d > %d)\n",
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 20ca38c7f870..f6c1016b2bb6 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -561,7 +561,7 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv,
561 lbs_deb_enter(LBS_DEB_CMD); 561 lbs_deb_enter(LBS_DEB_CMD);
562 562
563 if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) { 563 if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) {
564 dst_event->events = le16_to_cpu(cmd_event->events); 564 dst_event->events = cmd_event->events;
565 memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv)); 565 memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv));
566 } 566 }
567 567
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 5ef65ae0de5a..efdb720d9fe7 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -419,13 +419,13 @@ struct cmd_ds_802_11_rf_antenna {
419}; 419};
420 420
421struct cmd_ds_802_11_monitor_mode { 421struct cmd_ds_802_11_monitor_mode {
422 u16 action; 422 __le16 action;
423 u16 mode; 423 __le16 mode;
424}; 424};
425 425
426struct cmd_ds_set_boot2_ver { 426struct cmd_ds_set_boot2_ver {
427 u16 action; 427 __le16 action;
428 u16 version; 428 __le16 version;
429}; 429};
430 430
431struct cmd_ds_802_11_ps_mode { 431struct cmd_ds_802_11_ps_mode {
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index cccca311f75b..181ebf0fc0df 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -454,7 +454,7 @@ static int if_sdio_prog_helper(struct if_sdio_card *card)
454 454
455 chunk_size = min(size, (size_t)60); 455 chunk_size = min(size, (size_t)60);
456 456
457 *((u32*)chunk_buffer) = cpu_to_le32(chunk_size); 457 *((__le32*)chunk_buffer) = cpu_to_le32(chunk_size);
458 memcpy(chunk_buffer + 4, firmware, chunk_size); 458 memcpy(chunk_buffer + 4, firmware, chunk_size);
459/* 459/*
460 lbs_deb_sdio("sending %d bytes chunk\n", chunk_size); 460 lbs_deb_sdio("sending %d bytes chunk\n", chunk_size);
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index e9190a6a1dcf..a17371fe2fe4 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -107,7 +107,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv)
107 int rsp_len = sizeof(b2_cmd); 107 int rsp_len = sizeof(b2_cmd);
108 108
109 b2_cmd.action = 0; 109 b2_cmd.action = 0;
110 b2_cmd.version = cpu_to_le16(priv->boot2_version); 110 b2_cmd.version = priv->boot2_version;
111 111
112 if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), 112 if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd),
113 &b2_cmd, &rsp_len)) { 113 &b2_cmd, &rsp_len)) {
@@ -227,7 +227,7 @@ static int if_usb_probe(struct usb_interface *intf,
227 priv->hw_host_to_card = if_usb_host_to_card; 227 priv->hw_host_to_card = if_usb_host_to_card;
228 priv->hw_get_int_status = if_usb_get_int_status; 228 priv->hw_get_int_status = if_usb_get_int_status;
229 priv->hw_read_event_cause = if_usb_read_event_cause; 229 priv->hw_read_event_cause = if_usb_read_event_cause;
230 priv->boot2_version = le16_to_cpu(udev->descriptor.bcdDevice); 230 priv->boot2_version = udev->descriptor.bcdDevice;
231 231
232 /* Delay 200 ms to waiting for the FW ready */ 232 /* Delay 200 ms to waiting for the FW ready */
233 if_usb_submit_rx_urb(cardp); 233 if_usb_submit_rx_urb(cardp);