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

staging: wilc1000: split handle_rcvd_gnrl_async_info() to avoid leading tabs

Fix 'Too many leading tabs' issue found by checkpatch.pl script in
handle_rcvd_gnrl_async_info().
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b5f10db
......@@ -1314,74 +1314,50 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
u32 max_assoc_resp_info_len,
u32 *rcvd_assoc_resp_info_len);
static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
struct rcvd_async_info *rcvd_info)
static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
{
s32 result = 0;
u8 msg_type = 0;
u8 msg_id = 0;
u16 msg_len = 0;
u16 wid_id = (u16)WID_NIL;
u8 wid_len = 0;
u8 mac_status;
u8 mac_status_reason_code;
u8 mac_status_additional_info;
struct connect_info conn_info;
struct disconnect_info disconn_info;
s32 err = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
if (!hif_drv) {
netdev_err(vif->ndev, "Driver handler is NULL\n");
return -ENODEV;
}
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
hif_drv->hif_state == HOST_IF_CONNECTED ||
hif_drv->usr_scan_req.scan_result) {
if (!rcvd_info->buffer ||
!hif_drv->usr_conn_req.conn_result) {
netdev_err(vif->ndev, "driver is null\n");
return -EINVAL;
}
msg_type = rcvd_info->buffer[0];
if ('I' != msg_type) {
netdev_err(vif->ndev, "Received Message incorrect.\n");
return -EFAULT;
}
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.ssid);
hif_drv->usr_conn_req.ssid = NULL;
kfree(hif_drv->usr_conn_req.bssid);
hif_drv->usr_conn_req.bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
}
msg_id = rcvd_info->buffer[1];
msg_len = MAKE_WORD16(rcvd_info->buffer[2], rcvd_info->buffer[3]);
wid_id = MAKE_WORD16(rcvd_info->buffer[4], rcvd_info->buffer[5]);
wid_len = rcvd_info->buffer[6];
mac_status = rcvd_info->buffer[7];
mac_status_reason_code = rcvd_info->buffer[8];
mac_status_additional_info = rcvd_info->buffer[9];
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
u32 rcvd_assoc_resp_info_len = 0;
static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
u8 mac_status)
{
struct connect_resp_info *connect_resp_info = NULL;
struct connect_info conn_info;
struct host_if_drv *hif_drv = vif->hif_drv;
memset(&conn_info, 0, sizeof(struct connect_info));
if (mac_status == MAC_CONNECTED) {
u32 rcvd_assoc_resp_info_len;
memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
host_int_get_assoc_res_info(vif,
rcv_assoc_resp,
host_int_get_assoc_res_info(vif, rcv_assoc_resp,
MAX_ASSOC_RESP_FRAME_SIZE,
&rcvd_assoc_resp_info_len);
if (rcvd_assoc_resp_info_len != 0) {
s32 err = 0;
err = wilc_parse_assoc_resp_info(rcv_assoc_resp, rcvd_assoc_resp_info_len,
&connect_resp_info);
if (err) {
netdev_err(vif->ndev, "wilc_parse_assoc_resp_info() returned error %d\n", err);
netdev_err(vif->ndev,
"wilc_parse_assoc_resp_info() returned error %d\n",
err);
} else {
conn_info.status = connect_resp_info->status;
if (conn_info.status == SUCCESSFUL_STATUSCODE && connect_resp_info->ies) {
if (conn_info.status == SUCCESSFUL_STATUSCODE &&
connect_resp_info->ies) {
conn_info.resp_ies_len = connect_resp_info->ies_len;
conn_info.resp_ies = kmalloc(connect_resp_info->ies_len, GFP_KERNEL);
memcpy(conn_info.resp_ies, connect_resp_info->ies,
......@@ -1398,7 +1374,8 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
if (mac_status == MAC_CONNECTED &&
conn_info.status != SUCCESSFUL_STATUSCODE) {
netdev_err(vif->ndev, "Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
netdev_err(vif->ndev,
"Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
eth_zero_addr(wilc_connected_ssid);
} else if (mac_status == MAC_DISCONNECTED) {
netdev_err(vif->ndev, "Received MAC status is MAC_DISCONNECTED\n");
......@@ -1417,17 +1394,15 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
if (hif_drv->usr_conn_req.ies) {
conn_info.req_ies_len = hif_drv->usr_conn_req.ies_len;
conn_info.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
memcpy(conn_info.req_ies,
hif_drv->usr_conn_req.ies,
conn_info.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len,
GFP_KERNEL);
memcpy(conn_info.req_ies, hif_drv->usr_conn_req.ies,
hif_drv->usr_conn_req.ies_len);
}
del_timer(&hif_drv->connect_timer);
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
&conn_info,
mac_status,
NULL,
&conn_info, mac_status, NULL,
hif_drv->usr_conn_req.arg);
if (mac_status == MAC_CONNECTED &&
......@@ -1449,16 +1424,14 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
kfree(conn_info.req_ies);
conn_info.req_ies = NULL;
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.ssid);
hif_drv->usr_conn_req.ssid = NULL;
kfree(hif_drv->usr_conn_req.bssid);
hif_drv->usr_conn_req.bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
} else if ((mac_status == MAC_DISCONNECTED) &&
(hif_drv->hif_state == HOST_IF_CONNECTED)) {
host_int_free_user_conn_req(hif_drv);
}
static inline void host_int_handle_disconnect(struct wilc_vif *vif)
{
struct disconnect_info disconn_info;
struct host_if_drv *hif_drv = vif->hif_drv;
memset(&disconn_info, 0, sizeof(struct disconnect_info));
if (hif_drv->usr_scan_req.scan_result) {
......@@ -1475,9 +1448,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
wilc_set_power_mgmt(vif, 0, 0);
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
NULL,
0,
&disconn_info,
NULL, 0, &disconn_info,
hif_drv->usr_conn_req.arg);
} else {
netdev_err(vif->ndev, "Connect result NULL\n");
......@@ -1485,17 +1456,58 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
eth_zero_addr(hif_drv->assoc_bssid);
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.ssid);
hif_drv->usr_conn_req.ssid = NULL;
kfree(hif_drv->usr_conn_req.bssid);
hif_drv->usr_conn_req.bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
hif_drv->usr_conn_req.ies = NULL;
host_int_free_user_conn_req(hif_drv);
hif_drv->hif_state = HOST_IF_IDLE;
scan_while_connected = false;
}
static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,
struct rcvd_async_info *rcvd_info)
{
s32 result = 0;
u8 msg_type = 0;
u8 msg_id = 0;
u16 msg_len = 0;
u16 wid_id = (u16)WID_NIL;
u8 wid_len = 0;
u8 mac_status;
u8 mac_status_reason_code;
u8 mac_status_additional_info;
struct host_if_drv *hif_drv = vif->hif_drv;
if (!hif_drv) {
netdev_err(vif->ndev, "Driver handler is NULL\n");
return -ENODEV;
}
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
hif_drv->hif_state == HOST_IF_CONNECTED ||
hif_drv->usr_scan_req.scan_result) {
if (!rcvd_info->buffer ||
!hif_drv->usr_conn_req.conn_result) {
netdev_err(vif->ndev, "driver is null\n");
return -EINVAL;
}
msg_type = rcvd_info->buffer[0];
if ('I' != msg_type) {
netdev_err(vif->ndev, "Received Message incorrect.\n");
return -EFAULT;
}
msg_id = rcvd_info->buffer[1];
msg_len = MAKE_WORD16(rcvd_info->buffer[2], rcvd_info->buffer[3]);
wid_id = MAKE_WORD16(rcvd_info->buffer[4], rcvd_info->buffer[5]);
wid_len = rcvd_info->buffer[6];
mac_status = rcvd_info->buffer[7];
mac_status_reason_code = rcvd_info->buffer[8];
mac_status_additional_info = rcvd_info->buffer[9];
if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
host_int_parse_assoc_resp_info(vif, mac_status);
} else if ((mac_status == MAC_DISCONNECTED) &&
(hif_drv->hif_state == HOST_IF_CONNECTED)) {
host_int_handle_disconnect(vif);
} else if ((mac_status == MAC_DISCONNECTED) &&
(hif_drv->usr_scan_req.scan_result)) {
del_timer(&hif_drv->scan_timer);
......
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