diff options
author | Luciano Coelho <luciano.coelho@nokia.com> | 2009-10-15 03:33:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:48:19 -0400 |
commit | d0f63b202146f3281800ee44823740c8bbf38f11 (patch) | |
tree | e6cfd9e31039674135c5727cc192b3d4270a457d /drivers/net/wireless/wl12xx/wl1271_acx.c | |
parent | 0b5b72da1b21fe61926318dd842f6dd7c8862e9f (diff) |
wl1271: fix endianess issues
We were not handling endianess correctly. The wl1271 chip runs on
little-endian values. This patch makes sure that all the communication with
the wl1271 firmware is done in little-endian by using cpu_to_le* and
le*_to_cpu where appropriate.
Also, all the struct definitions for data exchanged with the firmware has
been changed to use __le16/32 types instead of u16/32.
This fixes a few sparse warnings, such as these:
drivers/net/wireless/wl12xx/wl1271_cmd.c:554:42: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:555:42: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:577:58: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:579:58: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:676:18: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:787:22: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_cmd.c:789:21: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_tx.c:98:47: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_acx.c:932:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_boot.c:191:32: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_boot.c:197:38: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_boot.c:199:37: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1271_init.c:255:40: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1271_init.c:275:53: warning: incorrect type in assignment (different base types)
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_acx.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_acx.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c index e891cd5bd25c..bf5a8680a462 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.c +++ b/drivers/net/wireless/wl12xx/wl1271_acx.c | |||
@@ -210,7 +210,7 @@ int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl) | |||
210 | goto out; | 210 | goto out; |
211 | } | 211 | } |
212 | 212 | ||
213 | acx->lifetime = wl->conf.rx.rx_msdu_life_time; | 213 | acx->lifetime = cpu_to_le32(wl->conf.rx.rx_msdu_life_time); |
214 | ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME, | 214 | ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME, |
215 | acx, sizeof(*acx)); | 215 | acx, sizeof(*acx)); |
216 | if (ret < 0) { | 216 | if (ret < 0) { |
@@ -236,8 +236,8 @@ int wl1271_acx_rx_config(struct wl1271 *wl, u32 config, u32 filter) | |||
236 | goto out; | 236 | goto out; |
237 | } | 237 | } |
238 | 238 | ||
239 | rx_config->config_options = config; | 239 | rx_config->config_options = cpu_to_le32(config); |
240 | rx_config->filter_options = filter; | 240 | rx_config->filter_options = cpu_to_le32(filter); |
241 | 241 | ||
242 | ret = wl1271_cmd_configure(wl, ACX_RX_CFG, | 242 | ret = wl1271_cmd_configure(wl, ACX_RX_CFG, |
243 | rx_config, sizeof(*rx_config)); | 243 | rx_config, sizeof(*rx_config)); |
@@ -264,7 +264,7 @@ int wl1271_acx_pd_threshold(struct wl1271 *wl) | |||
264 | goto out; | 264 | goto out; |
265 | } | 265 | } |
266 | 266 | ||
267 | pd->threshold = wl->conf.rx.packet_detection_threshold; | 267 | pd->threshold = cpu_to_le32(wl->conf.rx.packet_detection_threshold); |
268 | 268 | ||
269 | ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd)); | 269 | ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd)); |
270 | if (ret < 0) { | 270 | if (ret < 0) { |
@@ -348,8 +348,8 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl) | |||
348 | 348 | ||
349 | wl1271_debug(DEBUG_ACX, "acx service period timeout"); | 349 | wl1271_debug(DEBUG_ACX, "acx service period timeout"); |
350 | 350 | ||
351 | rx_timeout->ps_poll_timeout = wl->conf.rx.ps_poll_timeout; | 351 | rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout); |
352 | rx_timeout->upsd_timeout = wl->conf.rx.upsd_timeout; | 352 | rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout); |
353 | 353 | ||
354 | ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, | 354 | ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, |
355 | rx_timeout, sizeof(*rx_timeout)); | 355 | rx_timeout, sizeof(*rx_timeout)); |
@@ -377,7 +377,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold) | |||
377 | goto out; | 377 | goto out; |
378 | } | 378 | } |
379 | 379 | ||
380 | rts->threshold = rts_threshold; | 380 | rts->threshold = cpu_to_le16(rts_threshold); |
381 | 381 | ||
382 | ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); | 382 | ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); |
383 | if (ret < 0) { | 383 | if (ret < 0) { |
@@ -494,8 +494,8 @@ int wl1271_acx_conn_monit_params(struct wl1271 *wl) | |||
494 | goto out; | 494 | goto out; |
495 | } | 495 | } |
496 | 496 | ||
497 | acx->synch_fail_thold = wl->conf.conn.synch_fail_thold; | 497 | acx->synch_fail_thold = cpu_to_le32(wl->conf.conn.synch_fail_thold); |
498 | acx->bss_lose_timeout = wl->conf.conn.bss_lose_timeout; | 498 | acx->bss_lose_timeout = cpu_to_le32(wl->conf.conn.bss_lose_timeout); |
499 | 499 | ||
500 | ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS, | 500 | ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS, |
501 | acx, sizeof(*acx)); | 501 | acx, sizeof(*acx)); |
@@ -552,16 +552,18 @@ int wl1271_acx_sg_cfg(struct wl1271 *wl) | |||
552 | } | 552 | } |
553 | 553 | ||
554 | /* BT-WLAN coext parameters */ | 554 | /* BT-WLAN coext parameters */ |
555 | param->per_threshold = c->per_threshold; | 555 | param->per_threshold = cpu_to_le32(c->per_threshold); |
556 | param->max_scan_compensation_time = c->max_scan_compensation_time; | 556 | param->max_scan_compensation_time = |
557 | param->nfs_sample_interval = c->nfs_sample_interval; | 557 | cpu_to_le32(c->max_scan_compensation_time); |
558 | param->nfs_sample_interval = cpu_to_le16(c->nfs_sample_interval); | ||
558 | param->load_ratio = c->load_ratio; | 559 | param->load_ratio = c->load_ratio; |
559 | param->auto_ps_mode = c->auto_ps_mode; | 560 | param->auto_ps_mode = c->auto_ps_mode; |
560 | param->probe_req_compensation = c->probe_req_compensation; | 561 | param->probe_req_compensation = c->probe_req_compensation; |
561 | param->scan_window_compensation = c->scan_window_compensation; | 562 | param->scan_window_compensation = c->scan_window_compensation; |
562 | param->antenna_config = c->antenna_config; | 563 | param->antenna_config = c->antenna_config; |
563 | param->beacon_miss_threshold = c->beacon_miss_threshold; | 564 | param->beacon_miss_threshold = c->beacon_miss_threshold; |
564 | param->rate_adaptation_threshold = c->rate_adaptation_threshold; | 565 | param->rate_adaptation_threshold = |
566 | cpu_to_le32(c->rate_adaptation_threshold); | ||
565 | param->rate_adaptation_snr = c->rate_adaptation_snr; | 567 | param->rate_adaptation_snr = c->rate_adaptation_snr; |
566 | 568 | ||
567 | ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); | 569 | ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); |
@@ -588,7 +590,7 @@ int wl1271_acx_cca_threshold(struct wl1271 *wl) | |||
588 | goto out; | 590 | goto out; |
589 | } | 591 | } |
590 | 592 | ||
591 | detection->rx_cca_threshold = wl->conf.rx.rx_cca_threshold; | 593 | detection->rx_cca_threshold = cpu_to_le16(wl->conf.rx.rx_cca_threshold); |
592 | detection->tx_energy_detection = wl->conf.tx.tx_energy_detection; | 594 | detection->tx_energy_detection = wl->conf.tx.tx_energy_detection; |
593 | 595 | ||
594 | ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD, | 596 | ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD, |
@@ -616,8 +618,8 @@ int wl1271_acx_bcn_dtim_options(struct wl1271 *wl) | |||
616 | goto out; | 618 | goto out; |
617 | } | 619 | } |
618 | 620 | ||
619 | bb->beacon_rx_timeout = wl->conf.conn.beacon_rx_timeout; | 621 | bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout); |
620 | bb->broadcast_timeout = wl->conf.conn.broadcast_timeout; | 622 | bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout); |
621 | bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps; | 623 | bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps; |
622 | bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold; | 624 | bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold; |
623 | 625 | ||
@@ -645,7 +647,7 @@ int wl1271_acx_aid(struct wl1271 *wl, u16 aid) | |||
645 | goto out; | 647 | goto out; |
646 | } | 648 | } |
647 | 649 | ||
648 | acx_aid->aid = aid; | 650 | acx_aid->aid = cpu_to_le16(aid); |
649 | 651 | ||
650 | ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); | 652 | ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); |
651 | if (ret < 0) { | 653 | if (ret < 0) { |
@@ -672,9 +674,8 @@ int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask) | |||
672 | } | 674 | } |
673 | 675 | ||
674 | /* high event mask is unused */ | 676 | /* high event mask is unused */ |
675 | mask->high_event_mask = 0xffffffff; | 677 | mask->high_event_mask = cpu_to_le32(0xffffffff); |
676 | 678 | mask->event_mask = cpu_to_le32(event_mask); | |
677 | mask->event_mask = event_mask; | ||
678 | 679 | ||
679 | ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK, | 680 | ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK, |
680 | mask, sizeof(*mask)); | 681 | mask, sizeof(*mask)); |
@@ -773,8 +774,8 @@ int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates) | |||
773 | } | 774 | } |
774 | 775 | ||
775 | /* configure one default (one-size-fits-all) rate class */ | 776 | /* configure one default (one-size-fits-all) rate class */ |
776 | acx->rate_class_cnt = 1; | 777 | acx->rate_class_cnt = cpu_to_le32(1); |
777 | acx->rate_class[0].enabled_rates = enabled_rates; | 778 | acx->rate_class[0].enabled_rates = cpu_to_le32(enabled_rates); |
778 | acx->rate_class[0].short_retry_limit = c->short_retry_limit; | 779 | acx->rate_class[0].short_retry_limit = c->short_retry_limit; |
779 | acx->rate_class[0].long_retry_limit = c->long_retry_limit; | 780 | acx->rate_class[0].long_retry_limit = c->long_retry_limit; |
780 | acx->rate_class[0].aflags = c->aflags; | 781 | acx->rate_class[0].aflags = c->aflags; |
@@ -808,10 +809,10 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl) | |||
808 | struct conf_tx_ac_category *c = &(wl->conf.tx.ac_conf[i]); | 809 | struct conf_tx_ac_category *c = &(wl->conf.tx.ac_conf[i]); |
809 | acx->ac = c->ac; | 810 | acx->ac = c->ac; |
810 | acx->cw_min = c->cw_min; | 811 | acx->cw_min = c->cw_min; |
811 | acx->cw_max = c->cw_max; | 812 | acx->cw_max = cpu_to_le16(c->cw_max); |
812 | acx->aifsn = c->aifsn; | 813 | acx->aifsn = c->aifsn; |
813 | acx->reserved = 0; | 814 | acx->reserved = 0; |
814 | acx->tx_op_limit = c->tx_op_limit; | 815 | acx->tx_op_limit = cpu_to_le16(c->tx_op_limit); |
815 | 816 | ||
816 | ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); | 817 | ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); |
817 | if (ret < 0) { | 818 | if (ret < 0) { |
@@ -847,8 +848,8 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl) | |||
847 | acx->tsid = c->tsid; | 848 | acx->tsid = c->tsid; |
848 | acx->ps_scheme = c->ps_scheme; | 849 | acx->ps_scheme = c->ps_scheme; |
849 | acx->ack_policy = c->ack_policy; | 850 | acx->ack_policy = c->ack_policy; |
850 | acx->apsd_conf[0] = c->apsd_conf[0]; | 851 | acx->apsd_conf[0] = cpu_to_le32(c->apsd_conf[0]); |
851 | acx->apsd_conf[1] = c->apsd_conf[1]; | 852 | acx->apsd_conf[1] = cpu_to_le32(c->apsd_conf[1]); |
852 | 853 | ||
853 | ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); | 854 | ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); |
854 | if (ret < 0) { | 855 | if (ret < 0) { |
@@ -876,7 +877,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl) | |||
876 | goto out; | 877 | goto out; |
877 | } | 878 | } |
878 | 879 | ||
879 | acx->frag_threshold = wl->conf.tx.frag_threshold; | 880 | acx->frag_threshold = cpu_to_le16(wl->conf.tx.frag_threshold); |
880 | ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); | 881 | ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); |
881 | if (ret < 0) { | 882 | if (ret < 0) { |
882 | wl1271_warning("Setting of frag threshold failed: %d", ret); | 883 | wl1271_warning("Setting of frag threshold failed: %d", ret); |
@@ -902,8 +903,8 @@ int wl1271_acx_tx_config_options(struct wl1271 *wl) | |||
902 | goto out; | 903 | goto out; |
903 | } | 904 | } |
904 | 905 | ||
905 | acx->tx_compl_timeout = wl->conf.tx.tx_compl_timeout; | 906 | acx->tx_compl_timeout = cpu_to_le16(wl->conf.tx.tx_compl_timeout); |
906 | acx->tx_compl_threshold = wl->conf.tx.tx_compl_threshold; | 907 | acx->tx_compl_threshold = cpu_to_le16(wl->conf.tx.tx_compl_threshold); |
907 | ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx)); | 908 | ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx)); |
908 | if (ret < 0) { | 909 | if (ret < 0) { |
909 | wl1271_warning("Setting of tx options failed: %d", ret); | 910 | wl1271_warning("Setting of tx options failed: %d", ret); |
@@ -929,11 +930,11 @@ int wl1271_acx_mem_cfg(struct wl1271 *wl) | |||
929 | } | 930 | } |
930 | 931 | ||
931 | /* memory config */ | 932 | /* memory config */ |
932 | mem_conf->num_stations = cpu_to_le16(DEFAULT_NUM_STATIONS); | 933 | mem_conf->num_stations = DEFAULT_NUM_STATIONS; |
933 | mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS; | 934 | mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS; |
934 | mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS; | 935 | mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS; |
935 | mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES; | 936 | mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES; |
936 | mem_conf->total_tx_descriptors = ACX_TX_DESCRIPTORS; | 937 | mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS); |
937 | 938 | ||
938 | ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf, | 939 | ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf, |
939 | sizeof(*mem_conf)); | 940 | sizeof(*mem_conf)); |
@@ -973,7 +974,8 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl) | |||
973 | } | 974 | } |
974 | 975 | ||
975 | /* initialize TX block book keeping */ | 976 | /* initialize TX block book keeping */ |
976 | wl->tx_blocks_available = wl->target_mem_map->num_tx_mem_blocks; | 977 | wl->tx_blocks_available = |
978 | le32_to_cpu(wl->target_mem_map->num_tx_mem_blocks); | ||
977 | wl1271_debug(DEBUG_TX, "available tx blocks: %d", | 979 | wl1271_debug(DEBUG_TX, "available tx blocks: %d", |
978 | wl->tx_blocks_available); | 980 | wl->tx_blocks_available); |
979 | 981 | ||
@@ -993,9 +995,9 @@ int wl1271_acx_init_rx_interrupt(struct wl1271 *wl) | |||
993 | goto out; | 995 | goto out; |
994 | } | 996 | } |
995 | 997 | ||
996 | rx_conf->threshold = wl->conf.rx.irq_pkt_threshold; | 998 | rx_conf->threshold = cpu_to_le16(wl->conf.rx.irq_pkt_threshold); |
997 | rx_conf->timeout = wl->conf.rx.irq_timeout; | 999 | rx_conf->timeout = cpu_to_le16(wl->conf.rx.irq_timeout); |
998 | rx_conf->mblk_threshold = wl->conf.rx.irq_blk_threshold; | 1000 | rx_conf->mblk_threshold = cpu_to_le16(wl->conf.rx.irq_blk_threshold); |
999 | rx_conf->queue_type = wl->conf.rx.queue_type; | 1001 | rx_conf->queue_type = wl->conf.rx.queue_type; |
1000 | 1002 | ||
1001 | ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf, | 1003 | ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf, |