diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-05-25 23:36:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:45 -0400 |
commit | 981f187b7c4b237011d4175cae0120d5d203c0fd (patch) | |
tree | b4508fc33a9aed0177c18c3a4db5c4e500fdb646 /drivers/net/wireless/libertas/cmdresp.c | |
parent | 123e0e044091ca35a4766b38ae15032f2d41bcd6 (diff) |
[PATCH] libertas: first pass at fixing up endianness issues
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmdresp.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 162 |
1 files changed, 64 insertions, 98 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 3b069341f35f..e31d595e4753 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -123,37 +123,27 @@ static int wlan_ret_reg_access(wlan_private * priv, | |||
123 | switch (type) { | 123 | switch (type) { |
124 | case cmd_ret_mac_reg_access: | 124 | case cmd_ret_mac_reg_access: |
125 | { | 125 | { |
126 | struct cmd_ds_mac_reg_access *reg; | 126 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; |
127 | 127 | ||
128 | reg = | 128 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
129 | (struct cmd_ds_mac_reg_access *)&resp->params. | 129 | adapter->offsetvalue.value = le32_to_cpu(reg->value); |
130 | macreg; | ||
131 | |||
132 | adapter->offsetvalue.offset = reg->offset; | ||
133 | adapter->offsetvalue.value = reg->value; | ||
134 | break; | 130 | break; |
135 | } | 131 | } |
136 | 132 | ||
137 | case cmd_ret_bbp_reg_access: | 133 | case cmd_ret_bbp_reg_access: |
138 | { | 134 | { |
139 | struct cmd_ds_bbp_reg_access *reg; | 135 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; |
140 | reg = | ||
141 | (struct cmd_ds_bbp_reg_access *)&resp->params. | ||
142 | bbpreg; | ||
143 | 136 | ||
144 | adapter->offsetvalue.offset = reg->offset; | 137 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
145 | adapter->offsetvalue.value = reg->value; | 138 | adapter->offsetvalue.value = reg->value; |
146 | break; | 139 | break; |
147 | } | 140 | } |
148 | 141 | ||
149 | case cmd_ret_rf_reg_access: | 142 | case cmd_ret_rf_reg_access: |
150 | { | 143 | { |
151 | struct cmd_ds_rf_reg_access *reg; | 144 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; |
152 | reg = | ||
153 | (struct cmd_ds_rf_reg_access *)&resp->params. | ||
154 | rfreg; | ||
155 | 145 | ||
156 | adapter->offsetvalue.offset = reg->offset; | 146 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
157 | adapter->offsetvalue.value = reg->value; | 147 | adapter->offsetvalue.value = reg->value; |
158 | break; | 148 | break; |
159 | } | 149 | } |
@@ -178,7 +168,7 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
178 | 168 | ||
179 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); | 169 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); |
180 | 170 | ||
181 | adapter->fwreleasenumber = hwspec->fwreleasenumber; | 171 | adapter->fwreleasenumber = le32_to_cpu(hwspec->fwreleasenumber); |
182 | 172 | ||
183 | lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n", | 173 | lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n", |
184 | adapter->fwreleasenumber); | 174 | adapter->fwreleasenumber); |
@@ -203,19 +193,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
203 | if (i >= MRVDRV_MAX_REGION_CODE) { | 193 | if (i >= MRVDRV_MAX_REGION_CODE) { |
204 | adapter->regioncode = 0x10; | 194 | adapter->regioncode = 0x10; |
205 | adapter->regiontableindex = 0; | 195 | adapter->regiontableindex = 0; |
206 | lbs_pr_info( | 196 | lbs_pr_info("unidentified region code; using the default (USA)\n"); |
207 | "unidentified region code, use the default (USA)\n"); | ||
208 | } | 197 | } |
209 | 198 | ||
210 | if (adapter->current_addr[0] == 0xff) { | 199 | if (adapter->current_addr[0] == 0xff) |
211 | memmove(adapter->current_addr, hwspec->permanentaddr, | 200 | memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN); |
212 | ETH_ALEN); | ||
213 | } | ||
214 | 201 | ||
215 | memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); | 202 | memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); |
216 | if (priv->mesh_dev) | 203 | if (priv->mesh_dev) |
217 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, | 204 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); |
218 | ETH_ALEN); | ||
219 | 205 | ||
220 | if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { | 206 | if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { |
221 | ret = -1; | 207 | ret = -1; |
@@ -241,13 +227,15 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv, | |||
241 | lbs_deb_enter(LBS_DEB_CMD); | 227 | lbs_deb_enter(LBS_DEB_CMD); |
242 | 228 | ||
243 | lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n" | 229 | lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n" |
244 | " extsleepclk=%x\n", sp->error, sp->offset, | 230 | " extsleepclk=%x\n", le16_to_cpu(sp->error), |
245 | sp->stabletime, sp->calcontrol, sp->externalsleepclk); | 231 | le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), |
232 | sp->calcontrol, sp->externalsleepclk); | ||
233 | |||
246 | adapter->sp.sp_error = le16_to_cpu(sp->error); | 234 | adapter->sp.sp_error = le16_to_cpu(sp->error); |
247 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); | 235 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); |
248 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); | 236 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); |
249 | adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol); | 237 | adapter->sp.sp_calcontrol = sp->calcontrol; |
250 | adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); | 238 | adapter->sp.sp_extsleepclk = sp->externalsleepclk; |
251 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); | 239 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); |
252 | 240 | ||
253 | lbs_deb_enter(LBS_DEB_CMD); | 241 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -280,31 +268,27 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv, | |||
280 | 268 | ||
281 | lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, | 269 | lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, |
282 | querytype); | 270 | querytype); |
283 | lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", | 271 | lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize)); |
284 | le16_to_cpu(smib->bufsize)); | ||
285 | 272 | ||
286 | if (querytype == cmd_act_get) { | 273 | if (querytype == cmd_act_get) { |
287 | switch (oid) { | 274 | switch (oid) { |
288 | case fragthresh_i: | 275 | case fragthresh_i: |
289 | priv->adapter->fragthsd = | 276 | priv->adapter->fragthsd = |
290 | le16_to_cpu(* | 277 | le16_to_cpu(*((__le16 *)(smib->value))); |
291 | ((unsigned short *)(smib->value))); | ||
292 | lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n", | 278 | lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n", |
293 | priv->adapter->fragthsd); | 279 | priv->adapter->fragthsd); |
294 | break; | 280 | break; |
295 | case rtsthresh_i: | 281 | case rtsthresh_i: |
296 | priv->adapter->rtsthsd = | 282 | priv->adapter->rtsthsd = |
297 | le16_to_cpu(* | 283 | le16_to_cpu(*((__le16 *)(smib->value))); |
298 | ((unsigned short *)(smib->value))); | ||
299 | lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n", | 284 | lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n", |
300 | priv->adapter->rtsthsd); | 285 | priv->adapter->rtsthsd); |
301 | break; | 286 | break; |
302 | case short_retrylim_i: | 287 | case short_retrylim_i: |
303 | priv->adapter->txretrycount = | 288 | priv->adapter->txretrycount = |
304 | le16_to_cpu(* | 289 | le16_to_cpu(*((__le16 *)(smib->value))); |
305 | ((unsigned short *)(smib->value))); | ||
306 | lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n", | 290 | lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n", |
307 | priv->adapter->rtsthsd); | 291 | priv->adapter->rtsthsd); |
308 | break; | 292 | break; |
309 | default: | 293 | default: |
310 | break; | 294 | break; |
@@ -408,12 +392,10 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, | |||
408 | u16 action = le16_to_cpu(pAntenna->action); | 392 | u16 action = le16_to_cpu(pAntenna->action); |
409 | 393 | ||
410 | if (action == cmd_act_get_rx) | 394 | if (action == cmd_act_get_rx) |
411 | adapter->rxantennamode = | 395 | adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode); |
412 | le16_to_cpu(pAntenna->antennamode); | ||
413 | 396 | ||
414 | if (action == cmd_act_get_tx) | 397 | if (action == cmd_act_get_tx) |
415 | adapter->txantennamode = | 398 | adapter->txantennamode = le16_to_cpu(pAntenna->antennamode); |
416 | le16_to_cpu(pAntenna->antennamode); | ||
417 | 399 | ||
418 | lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", | 400 | lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", |
419 | action, le16_to_cpu(pAntenna->antennamode)); | 401 | action, le16_to_cpu(pAntenna->antennamode)); |
@@ -424,15 +406,14 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, | |||
424 | static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, | 406 | static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, |
425 | struct cmd_ds_command *resp) | 407 | struct cmd_ds_command *resp) |
426 | { | 408 | { |
427 | struct cmd_ds_802_11_rate_adapt_rateset *rates = | 409 | struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; |
428 | &resp->params.rateset; | ||
429 | wlan_adapter *adapter = priv->adapter; | 410 | wlan_adapter *adapter = priv->adapter; |
430 | 411 | ||
431 | lbs_deb_enter(LBS_DEB_CMD); | 412 | lbs_deb_enter(LBS_DEB_CMD); |
432 | 413 | ||
433 | if (rates->action == cmd_act_get) { | 414 | if (rates->action == cmd_act_get) { |
434 | adapter->enablehwauto = rates->enablehwauto; | 415 | adapter->enablehwauto = le16_to_cpu(rates->enablehwauto); |
435 | adapter->ratebitmap = rates->bitmap; | 416 | adapter->ratebitmap = le16_to_cpu(rates->bitmap); |
436 | } | 417 | } |
437 | 418 | ||
438 | lbs_deb_enter(LBS_DEB_CMD); | 419 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -452,7 +433,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, | |||
452 | (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); | 433 | (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); |
453 | 434 | ||
454 | dot11datarate = pdatarate->datarate[0]; | 435 | dot11datarate = pdatarate->datarate[0]; |
455 | if (pdatarate->action == cmd_act_get_tx_rate) { | 436 | if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) { |
456 | memcpy(adapter->libertas_supported_rates, pdatarate->datarate, | 437 | memcpy(adapter->libertas_supported_rates, pdatarate->datarate, |
457 | sizeof(adapter->libertas_supported_rates)); | 438 | sizeof(adapter->libertas_supported_rates)); |
458 | } | 439 | } |
@@ -465,8 +446,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, | |||
465 | static int wlan_ret_802_11_rf_channel(wlan_private * priv, | 446 | static int wlan_ret_802_11_rf_channel(wlan_private * priv, |
466 | struct cmd_ds_command *resp) | 447 | struct cmd_ds_command *resp) |
467 | { | 448 | { |
468 | struct cmd_ds_802_11_rf_channel *rfchannel = | 449 | struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; |
469 | &resp->params.rfchannel; | ||
470 | wlan_adapter *adapter = priv->adapter; | 450 | wlan_adapter *adapter = priv->adapter; |
471 | u16 action = le16_to_cpu(rfchannel->action); | 451 | u16 action = le16_to_cpu(rfchannel->action); |
472 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); | 452 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); |
@@ -494,12 +474,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv, | |||
494 | 474 | ||
495 | /* store the non average value */ | 475 | /* store the non average value */ |
496 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); | 476 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); |
497 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = | 477 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); |
498 | le16_to_cpu(rssirsp->noisefloor); | ||
499 | 478 | ||
500 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); | 479 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); |
501 | adapter->NF[TYPE_BEACON][TYPE_AVG] = | 480 | adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); |
502 | le16_to_cpu(rssirsp->avgnoisefloor); | ||
503 | 481 | ||
504 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = | 482 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = |
505 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], | 483 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], |
@@ -543,15 +521,13 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv, | |||
543 | static int wlan_ret_get_log(wlan_private * priv, | 521 | static int wlan_ret_get_log(wlan_private * priv, |
544 | struct cmd_ds_command *resp) | 522 | struct cmd_ds_command *resp) |
545 | { | 523 | { |
546 | struct cmd_ds_802_11_get_log *logmessage = | 524 | struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; |
547 | (struct cmd_ds_802_11_get_log *)&resp->params.glog; | ||
548 | wlan_adapter *adapter = priv->adapter; | 525 | wlan_adapter *adapter = priv->adapter; |
549 | 526 | ||
550 | lbs_deb_enter(LBS_DEB_CMD); | 527 | lbs_deb_enter(LBS_DEB_CMD); |
551 | 528 | ||
552 | /* TODO Convert it to Big Endian before copy */ | 529 | /* Stored little-endian */ |
553 | memcpy(&adapter->logmsg, logmessage, | 530 | memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); |
554 | sizeof(struct cmd_ds_802_11_get_log)); | ||
555 | 531 | ||
556 | lbs_deb_enter(LBS_DEB_CMD); | 532 | lbs_deb_enter(LBS_DEB_CMD); |
557 | return 0; | 533 | return 0; |
@@ -614,8 +590,7 @@ static inline int handle_cmd_response(u16 respcmd, | |||
614 | case cmd_ret_802_11_set_afc: | 590 | case cmd_ret_802_11_set_afc: |
615 | case cmd_ret_802_11_get_afc: | 591 | case cmd_ret_802_11_get_afc: |
616 | spin_lock_irqsave(&adapter->driver_lock, flags); | 592 | spin_lock_irqsave(&adapter->driver_lock, flags); |
617 | memmove(adapter->cur_cmd->pdata_buf, | 593 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, |
618 | &resp->params.afc, | ||
619 | sizeof(struct cmd_ds_802_11_afc)); | 594 | sizeof(struct cmd_ds_802_11_afc)); |
620 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 595 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
621 | 596 | ||
@@ -681,22 +656,19 @@ static inline int handle_cmd_response(u16 respcmd, | |||
681 | 656 | ||
682 | case cmd_ret_802_11_tpc_cfg: | 657 | case cmd_ret_802_11_tpc_cfg: |
683 | spin_lock_irqsave(&adapter->driver_lock, flags); | 658 | spin_lock_irqsave(&adapter->driver_lock, flags); |
684 | memmove(adapter->cur_cmd->pdata_buf, | 659 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, |
685 | &resp->params.tpccfg, | ||
686 | sizeof(struct cmd_ds_802_11_tpc_cfg)); | 660 | sizeof(struct cmd_ds_802_11_tpc_cfg)); |
687 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 661 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
688 | break; | 662 | break; |
689 | case cmd_ret_802_11_led_gpio_ctrl: | 663 | case cmd_ret_802_11_led_gpio_ctrl: |
690 | spin_lock_irqsave(&adapter->driver_lock, flags); | 664 | spin_lock_irqsave(&adapter->driver_lock, flags); |
691 | memmove(adapter->cur_cmd->pdata_buf, | 665 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, |
692 | &resp->params.ledgpio, | ||
693 | sizeof(struct cmd_ds_802_11_led_ctrl)); | 666 | sizeof(struct cmd_ds_802_11_led_ctrl)); |
694 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 667 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
695 | break; | 668 | break; |
696 | case cmd_ret_802_11_pwr_cfg: | 669 | case cmd_ret_802_11_pwr_cfg: |
697 | spin_lock_irqsave(&adapter->driver_lock, flags); | 670 | spin_lock_irqsave(&adapter->driver_lock, flags); |
698 | memmove(adapter->cur_cmd->pdata_buf, | 671 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, |
699 | &resp->params.pwrcfg, | ||
700 | sizeof(struct cmd_ds_802_11_pwr_cfg)); | 672 | sizeof(struct cmd_ds_802_11_pwr_cfg)); |
701 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 673 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
702 | 674 | ||
@@ -718,15 +690,13 @@ static inline int handle_cmd_response(u16 respcmd, | |||
718 | case cmd_ret_fwt_access: | 690 | case cmd_ret_fwt_access: |
719 | spin_lock_irqsave(&adapter->driver_lock, flags); | 691 | spin_lock_irqsave(&adapter->driver_lock, flags); |
720 | if (adapter->cur_cmd->pdata_buf) | 692 | if (adapter->cur_cmd->pdata_buf) |
721 | memcpy(adapter->cur_cmd->pdata_buf, | 693 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, |
722 | &resp->params.fwt, | 694 | sizeof(resp->params.fwt)); |
723 | sizeof(resp->params.fwt)); | ||
724 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 695 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
725 | break; | 696 | break; |
726 | case cmd_ret_mesh_access: | 697 | case cmd_ret_mesh_access: |
727 | if (adapter->cur_cmd->pdata_buf) | 698 | if (adapter->cur_cmd->pdata_buf) |
728 | memcpy(adapter->cur_cmd->pdata_buf, | 699 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, |
729 | &resp->params.mesh, | ||
730 | sizeof(resp->params.mesh)); | 700 | sizeof(resp->params.mesh)); |
731 | break; | 701 | break; |
732 | case cmd_rte_802_11_tx_rate_query: | 702 | case cmd_rte_802_11_tx_rate_query: |
@@ -734,7 +704,7 @@ static inline int handle_cmd_response(u16 respcmd, | |||
734 | break; | 704 | break; |
735 | default: | 705 | default: |
736 | lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n", | 706 | lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n", |
737 | resp->command); | 707 | resp->command); |
738 | break; | 708 | break; |
739 | } | 709 | } |
740 | return ret; | 710 | return ret; |
@@ -768,14 +738,14 @@ int libertas_process_rx_command(wlan_private * priv) | |||
768 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); | 738 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); |
769 | 739 | ||
770 | lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, | 740 | lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, |
771 | priv->upld_len); | 741 | priv->upld_len); |
772 | 742 | ||
773 | respcmd = le16_to_cpu(resp->command); | 743 | respcmd = le16_to_cpu(resp->command); |
774 | 744 | ||
775 | result = le16_to_cpu(resp->result); | 745 | result = le16_to_cpu(resp->result); |
776 | 746 | ||
777 | lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd, | 747 | lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd, |
778 | result, priv->upld_len); | 748 | result, priv->upld_len); |
779 | 749 | ||
780 | if (!(respcmd & 0x8000)) { | 750 | if (!(respcmd & 0x8000)) { |
781 | lbs_deb_cmd("Invalid response to command!"); | 751 | lbs_deb_cmd("Invalid response to command!"); |
@@ -789,31 +759,28 @@ int libertas_process_rx_command(wlan_private * priv) | |||
789 | } | 759 | } |
790 | 760 | ||
791 | /* Store the response code to cur_cmd_retcode. */ | 761 | /* Store the response code to cur_cmd_retcode. */ |
792 | adapter->cur_cmd_retcode = le16_to_cpu(resp->result); | 762 | adapter->cur_cmd_retcode = result;; |
793 | 763 | ||
794 | if (respcmd == cmd_ret_802_11_ps_mode) { | 764 | if (respcmd == cmd_ret_802_11_ps_mode) { |
795 | struct cmd_ds_802_11_ps_mode *psmode; | 765 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; |
766 | u16 action = le16_to_cpu(psmode->action); | ||
796 | 767 | ||
797 | psmode = &resp->params.psmode; | ||
798 | lbs_deb_cmd( | 768 | lbs_deb_cmd( |
799 | "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", | 769 | "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", |
800 | resp->result, psmode->action); | 770 | result, action); |
801 | psmode->action = cpu_to_le16(psmode->action); | ||
802 | 771 | ||
803 | if (result) { | 772 | if (result) { |
804 | lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n", | 773 | lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n", |
805 | resp->result); | 774 | result); |
806 | if (adapter->mode == IW_MODE_ADHOC) { | 775 | /* |
807 | /* | 776 | * We should not re-try enter-ps command in |
808 | * We should not re-try enter-ps command in | 777 | * ad-hoc mode. It takes place in |
809 | * ad-hoc mode. It takes place in | 778 | * libertas_execute_next_command(). |
810 | * libertas_execute_next_command(). | 779 | */ |
811 | */ | 780 | if (adapter->mode == IW_MODE_ADHOC && |
812 | if (psmode->action == cmd_subcmd_enter_ps) | 781 | action == cmd_subcmd_enter_ps) |
813 | adapter->psmode = | 782 | adapter->psmode = wlan802_11powermodecam; |
814 | wlan802_11powermodecam; | 783 | } else if (action == cmd_subcmd_enter_ps) { |
815 | } | ||
816 | } else if (psmode->action == cmd_subcmd_enter_ps) { | ||
817 | adapter->needtowakeup = 0; | 784 | adapter->needtowakeup = 0; |
818 | adapter->psstate = PS_STATE_AWAKE; | 785 | adapter->psstate = PS_STATE_AWAKE; |
819 | 786 | ||
@@ -832,13 +799,12 @@ int libertas_process_rx_command(wlan_private * priv) | |||
832 | mutex_lock(&adapter->lock); | 799 | mutex_lock(&adapter->lock); |
833 | spin_lock_irqsave(&adapter->driver_lock, flags); | 800 | spin_lock_irqsave(&adapter->driver_lock, flags); |
834 | } | 801 | } |
835 | } else if (psmode->action == cmd_subcmd_exit_ps) { | 802 | } else if (action == cmd_subcmd_exit_ps) { |
836 | adapter->needtowakeup = 0; | 803 | adapter->needtowakeup = 0; |
837 | adapter->psstate = PS_STATE_FULL_POWER; | 804 | adapter->psstate = PS_STATE_FULL_POWER; |
838 | lbs_deb_cmd("CMD_RESP: Exit_PS command response\n"); | 805 | lbs_deb_cmd("CMD_RESP: Exit_PS command response\n"); |
839 | } else { | 806 | } else { |
840 | lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", | 807 | lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action); |
841 | psmode->action); | ||
842 | } | 808 | } |
843 | 809 | ||
844 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 810 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); |
@@ -860,7 +826,7 @@ int libertas_process_rx_command(wlan_private * priv) | |||
860 | /* If the command is not successful, cleanup and return failure */ | 826 | /* If the command is not successful, cleanup and return failure */ |
861 | if ((result != 0 || !(respcmd & 0x8000))) { | 827 | if ((result != 0 || !(respcmd & 0x8000))) { |
862 | lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n", | 828 | lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n", |
863 | resp->command, resp->result); | 829 | respcmd, result); |
864 | /* | 830 | /* |
865 | * Handling errors here | 831 | * Handling errors here |
866 | */ | 832 | */ |