mwifiex: use little-endian variables in firmware structures
authorUjjal Roy <royujjal@gmail.com>
Tue, 3 Dec 2013 07:17:48 +0000 (23:17 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Dec 2013 20:35:27 +0000 (15:35 -0500)
The firmware expects the command structure members in little
endianness.

Signed-off-by: Ujjal Roy <royujjal@gmail.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cmdevt.c
drivers/net/wireless/mwifiex/fw.h
drivers/net/wireless/mwifiex/sta_cmd.c

index e47f4e3012b85344c7d400d78799634cb5bf0234..1ddc8b2e3722d5d9a9e72fad2422296b1754829f 100644 (file)
@@ -312,14 +312,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
        }
        if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY))
            == MWIFIEX_BSS_ROLE_STA) {
-               if (!sleep_cfm_buf->resp_ctrl)
+               if (!le16_to_cpu(sleep_cfm_buf->resp_ctrl))
                        /* Response is not needed for sleep
                           confirm command */
                        adapter->ps_state = PS_STATE_SLEEP;
                else
                        adapter->ps_state = PS_STATE_SLEEP_CFM;
 
-               if (!sleep_cfm_buf->resp_ctrl &&
+               if (!le16_to_cpu(sleep_cfm_buf->resp_ctrl) &&
                    (adapter->is_hs_configured &&
                     !adapter->sleep_period.period)) {
                        adapter->pm_wakeup_card_req = true;
index c8385ec77a86af678b36cf28a5d7c2fa8448de84..6998413c888127e5a895d24c3d6ce2065200821e 100644 (file)
@@ -610,12 +610,12 @@ struct mwifiex_ie_types_tsf_timestamp {
 struct mwifiex_cf_param_set {
        u8 cfp_cnt;
        u8 cfp_period;
-       u16 cfp_max_duration;
-       u16 cfp_duration_remaining;
+       __le16 cfp_max_duration;
+       __le16 cfp_duration_remaining;
 } __packed;
 
 struct mwifiex_ibss_param_set {
-       u16 atim_window;
+       __le16 atim_window;
 } __packed;
 
 struct mwifiex_ie_types_ss_param_set {
@@ -627,7 +627,7 @@ struct mwifiex_ie_types_ss_param_set {
 } __packed;
 
 struct mwifiex_fh_param_set {
-       u16 dwell_time;
+       __le16 dwell_time;
        u8 hop_set;
        u8 hop_pattern;
        u8 hop_index;
@@ -684,10 +684,10 @@ struct host_cmd_ds_802_11_key_material {
 } __packed;
 
 struct host_cmd_ds_gen {
-       u16 command;
-       u16 size;
-       u16 seq_num;
-       u16 result;
+       __le16 command;
+       __le16 size;
+       __le16 seq_num;
+       __le16 result;
 };
 
 #define S_DS_GEN        sizeof(struct host_cmd_ds_gen)
@@ -820,8 +820,8 @@ struct ieee_types_cf_param_set {
        u8 len;
        u8 cfp_cnt;
        u8 cfp_period;
-       u16 cfp_max_duration;
-       u16 cfp_duration_remaining;
+       __le16 cfp_max_duration;
+       __le16 cfp_duration_remaining;
 } __packed;
 
 struct ieee_types_ibss_param_set {
@@ -957,7 +957,7 @@ struct mwifiex_hs_config_param {
 } __packed;
 
 struct hs_activate_param {
-       u16 resp_ctrl;
+       __le16 resp_ctrl;
 } __packed;
 
 struct host_cmd_ds_802_11_hs_cfg_enh {
@@ -1131,7 +1131,7 @@ struct host_cmd_ds_802_11_bg_scan_query {
 } __packed;
 
 struct host_cmd_ds_802_11_bg_scan_query_rsp {
-       u32 report_condition;
+       __le32 report_condition;
        struct host_cmd_ds_802_11_scan_rsp scan_resp;
 } __packed;
 
@@ -1230,7 +1230,7 @@ struct mwifiex_ie_types_wmm_queue_status {
        struct mwifiex_ie_types_header header;
        u8 queue_index;
        u8 disabled;
-       u16 medium_time;
+       __le16 medium_time;
        u8 flow_required;
        u8 flow_created;
        u32 reserved;
@@ -1310,7 +1310,7 @@ struct mwifiex_ie_types_vht_oper {
        u8 chan_center_freq_1;
        u8 chan_center_freq_2;
        /* Basic MCS set map, each 2 bits stands for a NSS */
-       u16 basic_mcs_map;
+       __le16 basic_mcs_map;
 } __packed;
 
 struct mwifiex_ie_types_wmmcap {
index 2181ee283d823e19dafaa5b1b8a09fcb1b4f2b1a..1efa43ec1c6ec3921d143752b3fb7ab3d6511902 100644 (file)
@@ -354,7 +354,7 @@ mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv,
        }
        if (hs_activate) {
                hs_cfg->action = cpu_to_le16(HS_ACTIVATE);
-               hs_cfg->params.hs_activate.resp_ctrl = RESP_NEEDED;
+               hs_cfg->params.hs_activate.resp_ctrl = cpu_to_le16(RESP_NEEDED);
        } else {
                hs_cfg->action = cpu_to_le16(HS_CONFIGURE);
                hs_cfg->params.hs_config.conditions = hscfg_param->conditions;