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

staging: wilc1000: avoid the use of 'hif_driver_comp' completion variable

Instead of using extra completion variable to handle the sync call now
using msg->is_sync flag to handle the sync call.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cb6f1f57
...@@ -187,7 +187,6 @@ struct join_bss_param { ...@@ -187,7 +187,6 @@ struct join_bss_param {
}; };
static struct host_if_drv *terminated_handle; static struct host_if_drv *terminated_handle;
static struct completion hif_driver_comp;
static struct mutex hif_deinit_lock; static struct mutex hif_deinit_lock;
/* 'msg' should be free by the caller for syc */ /* 'msg' should be free by the caller for syc */
...@@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct *work) ...@@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct *work)
if (ret) if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n"); netdev_err(vif->ndev, "Failed to set driver handler\n");
complete(&hif_driver_comp);
kfree(buffer); kfree(buffer);
free_msg: free_msg:
if (msg->is_sync)
complete(&msg->work_comp);
kfree(msg); kfree(msg);
} }
...@@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct *work) ...@@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct *work)
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif)); wilc_get_vif_idx(vif));
if (hif_op_mode->mode == IDLE_MODE)
complete(&hif_driver_comp);
if (ret) if (ret)
netdev_err(vif->ndev, "Failed to set operation mode\n"); netdev_err(vif->ndev, "Failed to set operation mode\n");
...@@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) ...@@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
} }
int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
u8 ifc_id) u8 ifc_id, bool is_sync)
{ {
int result; int result;
struct host_if_msg *msg; struct host_if_msg *msg;
msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false); msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync);
if (IS_ERR(msg)) if (IS_ERR(msg))
return PTR_ERR(msg); return PTR_ERR(msg);
...@@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, ...@@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
if (result) { if (result) {
netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg); kfree(msg);
return result;
} }
if (is_sync)
wait_for_completion(&msg->work_comp);
return result; return result;
} }
...@@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) ...@@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
vif->obtaining_ip = false; vif->obtaining_ip = false;
if (wilc->clients_count == 0) { if (wilc->clients_count == 0)
init_completion(&hif_driver_comp);
mutex_init(&hif_deinit_lock); mutex_init(&hif_deinit_lock);
}
timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0); timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000)); mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
...@@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif) ...@@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&vif->periodic_rssi); del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer); del_timer_sync(&hif_drv->remain_on_ch_timer);
wilc_set_wfi_drv_handler(vif, 0, 0, 0); wilc_set_wfi_drv_handler(vif, 0, 0, 0, true);
wait_for_completion(&hif_driver_comp);
if (hif_drv->usr_scan_req.scan_result) { if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
......
...@@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, ...@@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
u8 ifc_id); u8 ifc_id, bool is_sync);
int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats,
bool is_sync); bool is_sync);
......
...@@ -750,7 +750,8 @@ static int wilc_mac_open(struct net_device *ndev) ...@@ -750,7 +750,8 @@ static int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) { for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) { if (ndev == wl->vif[i]->ndev) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
vif->iftype, vif->ifc_id); vif->iftype, vif->ifc_id,
false);
wilc_set_operation_mode(vif, vif->iftype); wilc_set_operation_mode(vif, vif->iftype);
break; break;
} }
......
...@@ -1779,7 +1779,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, ...@@ -1779,7 +1779,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
if (wl->initialized) { if (wl->initialized) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
0, vif->ifc_id); 0, vif->ifc_id, false);
wilc_set_operation_mode(vif, AP_MODE); wilc_set_operation_mode(vif, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0); wilc_set_power_mgmt(vif, 0, 0);
} }
......
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