staging: wilc1000: avoid deferred handling of cfg80211 disconnect callback

Refactor disconnect operation callback to handle from the cfg80211
context. The reason code is not required to pass as parameter to the
function, so remove it.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ajay Singh 2018-12-02 18:03:28 +00:00 committed by Greg Kroah-Hartman
parent 19cb25e1e6
commit 8e6d6cf0f2
3 changed files with 6 additions and 37 deletions

View File

@ -1241,10 +1241,8 @@ free_msg:
kfree(msg);
}
static void handle_disconnect(struct work_struct *work)
int wilc_disconnect(struct wilc_vif *vif)
{
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
struct disconnect_info disconn_info;
@ -1263,10 +1261,9 @@ static void handle_disconnect(struct work_struct *work)
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result) {
netdev_err(vif->ndev, "Failed to send dissconect\n");
goto out;
return result;
}
memset(&disconn_info, 0, sizeof(struct disconnect_info));
@ -1307,10 +1304,7 @@ static void handle_disconnect(struct work_struct *work)
kfree(conn_req->ies);
conn_req->ies = NULL;
out:
complete(&msg->work_comp);
/* free 'msg' in caller after receiving completion */
return 0;
}
void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
@ -1319,7 +1313,7 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
return;
if (vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
vif->hif_drv->hif_state == HOST_IF_CONNECTING)
wilc_disconnect(vif, 1);
wilc_disconnect(vif);
}
int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats)
@ -2012,31 +2006,6 @@ free_msg:
return result;
}
int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
{
int result;
struct host_if_msg *msg;
struct host_if_drv *hif_drv = vif->hif_drv;
if (!hif_drv) {
netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}
msg = wilc_alloc_work(vif, handle_disconnect, true);
if (IS_ERR(msg))
return PTR_ERR(msg);
result = wilc_enqueue_work(msg);
if (result)
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);
kfree(msg);
return result;
}
int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
{
struct wid wid;

View File

@ -264,7 +264,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
wilc_connect_result connect_result, void *user_arg,
u8 security, enum authtype auth_type,
u8 channel, void *join_params);
int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
int wilc_disconnect(struct wilc_vif *vif);
int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,

View File

@ -760,7 +760,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
priv->p2p.is_wilc_ie = false;
wfi_drv->p2p_timeout = 0;
ret = wilc_disconnect(vif, reason_code);
ret = wilc_disconnect(vif);
if (ret != 0) {
netdev_err(priv->dev, "Error in disconnecting\n");
ret = -EINVAL;