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

staging: wilc1000: move hif_workqueue static variables to 'wilc' structure

Avoid use of static variable hif_workqueue and move it inside 'wilc'
structure.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e624c58c
...@@ -188,7 +188,6 @@ struct join_bss_param { ...@@ -188,7 +188,6 @@ struct join_bss_param {
static struct host_if_drv *terminated_handle; static struct host_if_drv *terminated_handle;
static u8 p2p_listen_state; static u8 p2p_listen_state;
static struct workqueue_struct *hif_workqueue;
static struct completion hif_driver_comp; static struct completion hif_driver_comp;
static struct mutex hif_deinit_lock; static struct mutex hif_deinit_lock;
static struct timer_list periodic_rssi; static struct timer_list periodic_rssi;
...@@ -226,7 +225,11 @@ wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), ...@@ -226,7 +225,11 @@ wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *),
static int wilc_enqueue_work(struct host_if_msg *msg) static int wilc_enqueue_work(struct host_if_msg *msg)
{ {
INIT_WORK(&msg->work, msg->fn); INIT_WORK(&msg->work, msg->fn);
if (!hif_workqueue || !queue_work(hif_workqueue, &msg->work))
if (!msg->vif || !msg->vif->wilc || !msg->vif->wilc->hif_workqueue)
return -EINVAL;
if (!queue_work(msg->vif->wilc->hif_workqueue, &msg->work))
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -3459,8 +3462,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) ...@@ -3459,8 +3462,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
init_completion(&hif_driver_comp); init_completion(&hif_driver_comp);
mutex_init(&hif_deinit_lock); mutex_init(&hif_deinit_lock);
hif_workqueue = create_singlethread_workqueue("WILC_wq"); wilc->hif_workqueue = create_singlethread_workqueue("WILC_wq");
if (!hif_workqueue) { if (!wilc->hif_workqueue) {
netdev_err(vif->ndev, "Failed to create workqueue\n"); netdev_err(vif->ndev, "Failed to create workqueue\n");
kfree(hif_drv); kfree(hif_drv);
return -ENOMEM; return -ENOMEM;
...@@ -3538,7 +3541,7 @@ int wilc_deinit(struct wilc_vif *vif) ...@@ -3538,7 +3541,7 @@ int wilc_deinit(struct wilc_vif *vif)
wait_for_completion(&msg->work_comp); wait_for_completion(&msg->work_comp);
kfree(msg); kfree(msg);
} }
destroy_workqueue(hif_workqueue); destroy_workqueue(vif->wilc->hif_workqueue);
} }
kfree(hif_drv); kfree(hif_drv);
......
...@@ -172,6 +172,7 @@ struct wilc { ...@@ -172,6 +172,7 @@ struct wilc {
struct rf_info dummy_statistics; struct rf_info dummy_statistics;
bool enable_ps; bool enable_ps;
int clients_count; int clients_count;
struct workqueue_struct *hif_workqueue;
}; };
struct wilc_wfi_mon_priv { struct wilc_wfi_mon_priv {
......
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