Commit bfaf36a4 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

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: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 64f656cb
...@@ -18,14 +18,6 @@ static inline u8 *get_bssid(struct ieee80211_mgmt *mgmt) ...@@ -18,14 +18,6 @@ static inline u8 *get_bssid(struct ieee80211_mgmt *mgmt)
return mgmt->bssid; 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, s32 wilc_parse_network_info(u8 *msg_buffer,
struct network_info **ret_network_info) struct network_info **ret_network_info)
{ {
...@@ -116,12 +108,12 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, ...@@ -116,12 +108,12 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
{ {
u8 *ies; u8 *ies;
u16 ies_len; 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) { if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; ies = &buffer[sizeof(*res)];
ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN + ies_len = buffer_len - sizeof(*res);
AID_LEN);
ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL); ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL);
if (!ret_conn_info->resp_ies) if (!ret_conn_info->resp_ies)
......
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
#define NUM_RSSI 5 #define NUM_RSSI 5
#define CAP_INFO_LEN 2
#define STATUS_CODE_LEN 2
#define AID_LEN 2
#define SET_CFG 0 #define SET_CFG 0
#define GET_CFG 1 #define GET_CFG 1
...@@ -63,6 +59,12 @@ struct disconnect_info { ...@@ -63,6 +59,12 @@ struct disconnect_info {
size_t ie_len; size_t ie_len;
}; };
struct assoc_resp {
__le16 capab_info;
__le16 status_code;
__le16 aid;
} __packed;
s32 wilc_parse_network_info(u8 *msg_buffer, s32 wilc_parse_network_info(u8 *msg_buffer,
struct network_info **ret_network_info); struct network_info **ret_network_info);
s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment