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

staging: wilc1000: refactor host_int_parse_assoc_resp_info() to remove unused code

Remove 'connect_resp_info' structure as most of its elements are not used.

Modified wilc_parse_assoc_resp_info() to directly parse and fill value
in connect_info structure variable. Remove use of 'assoc_resp_len' variable.
get_assoc_resp_cap_info() & get_asoc_id() functions are remove as its
not used anymore.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b2f86aa1
...@@ -207,16 +207,6 @@ static inline u16 get_cap_info(u8 *data) ...@@ -207,16 +207,6 @@ static inline u16 get_cap_info(u8 *data)
return cap_info; return cap_info;
} }
static inline u16 get_assoc_resp_cap_info(u8 *data)
{
u16 cap_info;
cap_info = data[0];
cap_info |= (data[1] << 8);
return cap_info;
}
static inline u16 get_asoc_status(u8 *data) static inline u16 get_asoc_status(u8 *data)
{ {
u16 asoc_status; u16 asoc_status;
...@@ -225,16 +215,6 @@ static inline u16 get_asoc_status(u8 *data) ...@@ -225,16 +215,6 @@ static inline u16 get_asoc_status(u8 *data)
return (asoc_status << 8) | data[2]; return (asoc_status << 8) | data[2];
} }
static inline u16 get_asoc_id(u8 *data)
{
u16 asoc_id;
asoc_id = data[4];
asoc_id |= (data[5] << 8);
return asoc_id;
}
static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 tag_param_offset) static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 tag_param_offset)
{ {
u16 index; u16 index;
...@@ -338,38 +318,23 @@ s32 wilc_parse_network_info(u8 *msg_buffer, ...@@ -338,38 +318,23 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
} }
s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
struct connect_resp_info **ret_connect_resp_info) struct connect_info *ret_conn_info)
{ {
struct connect_resp_info *connect_resp_info = NULL;
u16 assoc_resp_len = 0;
u8 *ies = NULL; u8 *ies = NULL;
u16 ies_len = 0; u16 ies_len = 0;
connect_resp_info = kzalloc(sizeof(*connect_resp_info), GFP_KERNEL); ret_conn_info->status = get_asoc_status(buffer);
if (!connect_resp_info) if (ret_conn_info->status == SUCCESSFUL_STATUSCODE) {
return -ENOMEM;
assoc_resp_len = (u16)buffer_len;
connect_resp_info->status = get_asoc_status(buffer);
if (connect_resp_info->status == SUCCESSFUL_STATUSCODE) {
connect_resp_info->capability = get_assoc_resp_cap_info(buffer);
connect_resp_info->assoc_id = get_asoc_id(buffer);
ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; ies = &buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
ies_len = assoc_resp_len - (CAP_INFO_LEN + STATUS_CODE_LEN + ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
AID_LEN); AID_LEN);
connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); ret_conn_info->resp_ies = kmemdup(ies, ies_len, GFP_KERNEL);
if (!connect_resp_info->ies) { if (!ret_conn_info->resp_ies)
kfree(connect_resp_info);
return -ENOMEM; return -ENOMEM;
}
connect_resp_info->ies_len = ies_len; ret_conn_info->resp_ies_len = ies_len;
} }
*ret_connect_resp_info = connect_resp_info;
return 0; return 0;
} }
...@@ -71,14 +71,6 @@ struct network_info { ...@@ -71,14 +71,6 @@ struct network_info {
u64 tsf_hi; u64 tsf_hi;
}; };
struct connect_resp_info {
u16 capability;
u16 status;
u16 assoc_id;
u8 *ies;
u16 ies_len;
};
struct connect_info { struct connect_info {
u8 bssid[6]; u8 bssid[6];
u8 *req_ies; u8 *req_ies;
...@@ -97,7 +89,7 @@ struct disconnect_info { ...@@ -97,7 +89,7 @@ struct disconnect_info {
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,
struct connect_resp_info **ret_connect_resp_info); struct connect_info *ret_conn_info);
void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length); void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length); void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length); void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
......
...@@ -1297,7 +1297,6 @@ static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv) ...@@ -1297,7 +1297,6 @@ static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
u8 mac_status) u8 mac_status)
{ {
struct connect_resp_info *connect_resp_info = NULL;
struct connect_info conn_info; struct connect_info conn_info;
struct host_if_drv *hif_drv = vif->hif_drv; struct host_if_drv *hif_drv = vif->hif_drv;
...@@ -1317,26 +1316,11 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, ...@@ -1317,26 +1316,11 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
err = wilc_parse_assoc_resp_info(rcv_assoc_resp, err = wilc_parse_assoc_resp_info(rcv_assoc_resp,
assoc_resp_info_len, assoc_resp_info_len,
&connect_resp_info); &conn_info);
if (err) { if (err)
netdev_err(vif->ndev, netdev_err(vif->ndev,
"wilc_parse_assoc_resp_info() returned error %d\n", "wilc_parse_assoc_resp_info() returned error %d\n",
err); err);
} else {
conn_info.status = connect_resp_info->status;
if (conn_info.status == SUCCESSFUL_STATUSCODE &&
connect_resp_info->ies) {
conn_info.resp_ies = kmemdup(connect_resp_info->ies,
connect_resp_info->ies_len,
GFP_KERNEL);
if (conn_info.resp_ies)
conn_info.resp_ies_len = connect_resp_info->ies_len;
}
kfree(connect_resp_info->ies);
kfree(connect_resp_info);
}
} }
} }
......
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