diff options
author | Tobin C. Harding <me@tobin.cc> | 2017-05-08 14:29:43 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-15 07:43:53 +0200 |
commit | 683356d16b0f5f97058e2377590bf365fdc97d79 (patch) | |
tree | a750ab7a0cc3772921c3b83fa8aa958f70a26de3 /drivers/staging/ks7010 | |
parent | c27fbc9237cde91e8eb75220119cd4c2bbc7082a (diff) |
staging: ks7010: hostif, u16 data types to __le16
Target device is little endian. Host interface data structures used
for building frames to pass to target device should use little endian
data types. All u16 structure members in ks_hostif.h need to be
changed to __le16, Sparse can then be used to make sure we update all
code that touches these data.
Change all u16 data types in host interface structures to be
__le16. Update all code that touches modified data types. Check using
Sparse.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r-- | drivers/staging/ks7010/ks_hostif.c | 14 | ||||
-rw-r--r-- | drivers/staging/ks7010/ks_hostif.h | 130 |
2 files changed, 72 insertions, 72 deletions
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index caf2551bc087..cf9b22feb451 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -147,7 +147,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info_t *ap_info) /* noise */ ap->noise = ap_info->noise; /* capability */ - ap->capability = ap_info->capability; + ap->capability = le16_to_cpu(ap_info->capability); /* rsn */ if ((ap_info->rsn_mode & RSN_MODE_WPA2) && (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) { @@ -233,12 +233,12 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, /* noise */ ap->noise = ap_info->noise; /* capability */ - ap->capability = ap_info->capability; + ap->capability = le16_to_cpu(ap_info->capability); /* channel */ ap->channel = ap_info->ch_info; bp = ap_info->body; - bsize = ap_info->body_size; + bsize = le16_to_cpu(ap_info->body_size); offset = 0; while (bsize > offset) { @@ -948,18 +948,18 @@ void hostif_associate_indication(struct ks_wlan_private *priv) wrqu.data.length += sizeof(associnfo_leader0) - 1; pbuf += sizeof(associnfo_leader0) - 1; - for (i = 0; i < assoc_req->req_ies_size; i++) + for (i = 0; i < le16_to_cpu(assoc_req->req_ies_size); i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_req->req_ies_size) * 2; + wrqu.data.length += (le16_to_cpu(assoc_req->req_ies_size)) * 2; memcpy(pbuf, associnfo_leader1, sizeof(associnfo_leader1) - 1); wrqu.data.length += sizeof(associnfo_leader1) - 1; pbuf += sizeof(associnfo_leader1) - 1; pb += assoc_req->req_ies_size; - for (i = 0; i < assoc_resp->resp_ies_size; i++) + for (i = 0; i < le16_to_cpu(assoc_resp->resp_ies_size); i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_resp->resp_ies_size) * 2; + wrqu.data.length += (le16_to_cpu(assoc_resp->resp_ies_size)) * 2; pbuf += sprintf(pbuf, ")"); wrqu.data.length += 1; diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 538600f9e376..35d51fea46af 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -68,21 +68,21 @@ struct hostif_hdr { struct hostif_data_request_t { struct hostif_hdr header; - u16 auth_type; + __le16 auth_type; #define TYPE_DATA 0x0000 #define TYPE_AUTH 0x0001 - u16 reserved; + __le16 reserved; u8 data[0]; } __packed; struct hostif_data_indication_t { struct hostif_hdr header; - u16 auth_type; + __le16 auth_type; /* #define TYPE_DATA 0x0000 */ #define TYPE_PMK1 0x0001 #define TYPE_GMK1 0x0002 #define TYPE_GMK2 0x0003 - u16 reserved; + __le16 reserved; u8 data[0]; } __packed; @@ -147,8 +147,8 @@ struct hostif_mib_get_request_t { } __packed; struct hostif_mib_value_t { - u16 size; - u16 type; + __le16 size; + __le16 type; #define MIB_VALUE_TYPE_NULL 0 #define MIB_VALUE_TYPE_INT 1 #define MIB_VALUE_TYPE_BOOL 2 @@ -207,12 +207,12 @@ enum power_mgmt_mode_type { struct hostif_power_mgmt_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; struct hostif_start_request_t { struct hostif_hdr header; - u16 mode; + __le16 mode; #define MODE_PSEUDO_ADHOC 0 #define MODE_INFRASTRUCTURE 1 #define MODE_AP 2 /* not used */ @@ -221,7 +221,7 @@ struct hostif_start_request_t { struct hostif_start_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; #define SSID_MAX_SIZE 32 @@ -239,7 +239,7 @@ struct rate_set8_t { } __packed; struct fh_parms_t { - u16 dwell_time; + __le16 dwell_time; u8 hop_set; u8 hop_pattern; u8 hop_index; @@ -252,12 +252,12 @@ struct ds_parms_t { struct cf_parms_t { u8 count; u8 period; - u16 max_duration; - u16 dur_remaining; + __le16 max_duration; + __le16 dur_remaining; } __packed; struct ibss_parms_t { - u16 atim_window; + __le16 atim_window; } __packed; struct rsn_t { @@ -282,8 +282,8 @@ struct ap_info_t { u8 sq; /* +07 */ u8 noise; /* +08 */ u8 pad0; /* +09 */ - u16 beacon_period; /* +10 */ - u16 capability; /* +12 */ + __le16 beacon_period; /* +10 */ + __le16 capability; /* +12 */ #define BSS_CAP_ESS BIT(0) #define BSS_CAP_IBSS BIT(1) #define BSS_CAP_CF_POLABLE BIT(2) @@ -298,7 +298,7 @@ struct ap_info_t { u8 ch_info; /* +15 */ #define FRAME_TYPE_BEACON 0x80 #define FRAME_TYPE_PROBE_RESP 0x50 - u16 body_size; /* +16 */ + __le16 body_size; /* +16 */ u8 body[1024]; /* +18 */ /* +1032 */ } __packed; @@ -309,8 +309,8 @@ struct link_ap_info_t { u8 sq; /* +07 */ u8 noise; /* +08 */ u8 pad0; /* +09 */ - u16 beacon_period; /* +10 */ - u16 capability; /* +12 */ + __le16 beacon_period; /* +10 */ + __le16 capability; /* +12 */ struct rate_set8_t rate_set; /* +14 */ struct fh_parms_t fh_parameter; /* +24 */ struct ds_parms_t ds_parameter; /* +29 */ @@ -332,7 +332,7 @@ struct link_ap_info_t { struct hostif_connect_indication_t { struct hostif_hdr header; - u16 connect_code; + __le16 connect_code; #define RESULT_CONNECT 0 #define RESULT_DISCONNECT 1 struct link_ap_info_t link_ap_info; @@ -344,7 +344,7 @@ struct hostif_stop_request_t { struct hostif_stop_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; /** @@ -356,23 +356,23 @@ struct hostif_stop_confirm_t { */ struct hostif_ps_adhoc_set_request_t { struct hostif_hdr header; - u16 phy_type; + __le16 phy_type; #define D_11B_ONLY_MODE 0 #define D_11G_ONLY_MODE 1 #define D_11BG_COMPATIBLE_MODE 2 #define D_11A_ONLY_MODE 3 - u16 cts_mode; + __le16 cts_mode; #define CTS_MODE_FALSE 0 #define CTS_MODE_TRUE 1 - u16 channel; + __le16 channel; struct rate_set16_t rate_set; - u16 capability; - u16 scan_type; + __le16 capability; + __le16 scan_type; } __packed; struct hostif_ps_adhoc_set_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; /** @@ -384,17 +384,17 @@ struct hostif_ps_adhoc_set_confirm_t { */ struct hostif_infrastructure_set_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; + __le16 phy_type; + __le16 cts_mode; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 beacon_lost_count; - u16 auth_type; + __le16 capability; + __le16 beacon_lost_count; + __le16 auth_type; #define AUTH_TYPE_OPEN_SYSTEM 0 #define AUTH_TYPE_SHARED_KEY 1 struct channel_list_t channel_list; - u16 scan_type; + __le16 scan_type; } __packed; /** @@ -406,23 +406,23 @@ struct hostif_infrastructure_set_request_t { */ struct hostif_infrastructure_set2_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; + __le16 phy_type; + __le16 cts_mode; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 beacon_lost_count; - u16 auth_type; + __le16 capability; + __le16 beacon_lost_count; + __le16 auth_type; #define AUTH_TYPE_OPEN_SYSTEM 0 #define AUTH_TYPE_SHARED_KEY 1 struct channel_list_t channel_list; - u16 scan_type; + __le16 scan_type; u8 bssid[ETH_ALEN]; } __packed; struct hostif_infrastructure_set_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; /** @@ -434,13 +434,13 @@ struct hostif_infrastructure_set_confirm_t { */ struct hostif_adhoc_set_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; - u16 channel; + __le16 phy_type; + __le16 cts_mode; + __le16 channel; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 scan_type; + __le16 capability; + __le16 scan_type; } __packed; /** @@ -452,20 +452,20 @@ struct hostif_adhoc_set_request_t { */ struct hostif_adhoc_set2_request_t { struct hostif_hdr header; - u16 phy_type; - u16 cts_mode; - u16 reserved; + __le16 phy_type; + __le16 cts_mode; + __le16 reserved; struct rate_set16_t rate_set; struct ssid_t ssid; - u16 capability; - u16 scan_type; + __le16 capability; + __le16 scan_type; struct channel_list_t channel_list; u8 bssid[ETH_ALEN]; } __packed; struct hostif_adhoc_set_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; struct last_associate_t { @@ -478,10 +478,10 @@ struct association_request_t { #define FRAME_TYPE_ASSOC_REQ 0x00 #define FRAME_TYPE_REASSOC_REQ 0x20 u8 pad; - u16 capability; - u16 listen_interval; + __le16 capability; + __le16 listen_interval; u8 ap_address[6]; - u16 req_ies_size; + __le16 req_ies_size; } __packed; struct association_response_t { @@ -489,10 +489,10 @@ struct association_response_t { #define FRAME_TYPE_ASSOC_RESP 0x10 #define FRAME_TYPE_REASSOC_RESP 0x30 u8 pad; - u16 capability; - u16 status; - u16 association_id; - u16 resp_ies_size; + __le16 capability; + __le16 status; + __le16 association_id; + __le16 resp_ies_size; } __packed; struct hostif_associate_indication_t { @@ -517,16 +517,16 @@ struct hostif_bss_scan_request_t { struct hostif_bss_scan_confirm_t { struct hostif_hdr header; - u16 result_code; - u16 reserved; + __le16 result_code; + __le16 reserved; } __packed; struct hostif_phy_information_request_t { struct hostif_hdr header; - u16 type; + __le16 type; #define NORMAL_TYPE 0 #define TIME_TYPE 1 - u16 time; /* unit 100ms */ + __le16 time; /* unit 100ms */ } __packed; struct hostif_phy_information_confirm_t { @@ -552,18 +552,18 @@ struct hostif_sleep_request_t { struct hostif_sleep_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; struct hostif_mic_failure_request_t { struct hostif_hdr header; - u16 failure_count; - u16 timer; + __le16 failure_count; + __le16 timer; } __packed; struct hostif_mic_failure_confirm_t { struct hostif_hdr header; - u16 result_code; + __le16 result_code; } __packed; #define BASIC_RATE 0x80 |