diff options
author | Ajay Singh | 2018-11-01 17:45:17 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2018-11-05 15:23:01 +0100 |
commit | bfaf36a4082a89c53d7632af264656ba2fbb2be9 (patch) | |
tree | 6948780b472af1e0499ca638373a374587efdb24 /drivers/staging/wilc1000 | |
parent | staging: wilc1000: avoid line over 80 chars in wilc_parse_network_info() (diff) | |
download | kernel-qcow2-linux-bfaf36a4082a89c53d7632af264656ba2fbb2be9.tar.gz kernel-qcow2-linux-bfaf36a4082a89c53d7632af264656ba2fbb2be9.tar.xz kernel-qcow2-linux-bfaf36a4082a89c53d7632af264656ba2fbb2be9.zip |
staging: wilc1000: refactor wilc_parse_assoc_resp_info()
Refactor wilc_parse_assoc_resp_info() function by removing the use of
get_asoc_status() API. For parsing assoc response use the struct and
avoided the use of offset macros to extract the ies information.
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r-- | drivers/staging/wilc1000/coreconfigurator.c | 16 | ||||
-rw-r--r-- | drivers/staging/wilc1000/coreconfigurator.h | 10 |
2 files changed, 10 insertions, 16 deletions
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 2c77e5aad0d6..2bd62fd5cbe3 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -18,14 +18,6 @@ static inline u8 *get_bssid(struct ieee80211_mgmt *mgmt) return mgmt->bssid; } -static inline u16 get_asoc_status(u8 *data) -{ - u16 asoc_status; - - asoc_status = data[3]; - return (asoc_status << 8) | data[2]; -} - s32 wilc_parse_network_info(u8 *msg_buffer, struct network_info **ret_network_info) { @@ -116,12 +108,12 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, { u8 *ies; u16 ies_len; + struct assoc_resp *res = (struct assoc_resp *)buffer; - ret_conn_info->status = get_asoc_status(buffer); + ret_conn_info->status = le16_to_cpu(res->status_code); if (ret_conn_info->status == WLAN_STATUS_SUCCESS) { - ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; - ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN + - AID_LEN); + ies = &buffer[sizeof(*res)]; + ies_len = buffer_len - sizeof(*res); ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL); if (!ret_conn_info->resp_ies) diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 0d40c77f2706..71a9f27d4b8f 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -11,10 +11,6 @@ #define NUM_RSSI 5 -#define CAP_INFO_LEN 2 -#define STATUS_CODE_LEN 2 -#define AID_LEN 2 - #define SET_CFG 0 #define GET_CFG 1 @@ -63,6 +59,12 @@ struct disconnect_info { size_t ie_len; }; +struct assoc_resp { + __le16 capab_info; + __le16 status_code; + __le16 aid; +} __packed; + s32 wilc_parse_network_info(u8 *msg_buffer, struct network_info **ret_network_info); s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, |