Skip to content

Commit

Permalink
wilc1000: move 'deinit_lock' lock init/destroy inside module probe
Browse files Browse the repository at this point in the history
Move initialization & deinitialization of 'deinit_lock' mutex lock inside
wlan_init_locks() & wlan_deinit_locks() API's respectively alongside other
locks. After the movement, the client count variable(client_count) which is
used for lock init/deinit is removed.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210916164902.74629-2-ajay.kathat@microchip.com
  • Loading branch information
ajaykathat authored and Kalle Valo committed Sep 21, 2021
1 parent 31f97cf commit c8e2036
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions drivers/net/wireless/microchip/wilc1000/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,7 @@ static void wlan_init_locks(struct wilc *wl)
mutex_init(&wl->rxq_cs);
mutex_init(&wl->cfg_cmd_lock);
mutex_init(&wl->vif_mutex);
mutex_init(&wl->deinit_lock);

spin_lock_init(&wl->txq_spinlock);
mutex_init(&wl->txq_add_to_head_cs);
Expand All @@ -1701,6 +1702,7 @@ void wlan_deinit_locks(struct wilc *wilc)
mutex_destroy(&wilc->cfg_cmd_lock);
mutex_destroy(&wilc->txq_add_to_head_cs);
mutex_destroy(&wilc->vif_mutex);
mutex_destroy(&wilc->deinit_lock);
cleanup_srcu_struct(&wilc->srcu);
}

Expand Down
7 changes: 0 additions & 7 deletions drivers/net/wireless/microchip/wilc1000/hif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
{
struct host_if_drv *hif_drv;
struct wilc_vif *vif = netdev_priv(dev);
struct wilc *wilc = vif->wilc;

hif_drv = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
if (!hif_drv)
Expand All @@ -1504,9 +1503,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)

vif->hif_drv = hif_drv;

if (wilc->clients_count == 0)
mutex_init(&wilc->deinit_lock);

timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));

Expand All @@ -1518,8 +1514,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)

hif_drv->p2p_timeout = 0;

wilc->clients_count++;

return 0;
}

Expand Down Expand Up @@ -1550,7 +1544,6 @@ int wilc_deinit(struct wilc_vif *vif)

kfree(hif_drv);
vif->hif_drv = NULL;
vif->wilc->clients_count--;
mutex_unlock(&vif->wilc->deinit_lock);
return result;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/microchip/wilc1000/netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ struct wilc {
struct device *dev;
bool suspend_event;

int clients_count;
struct workqueue_struct *hif_workqueue;
enum chip_ps_states chip_ps_state;
struct wilc_cfg cfg;
Expand Down

0 comments on commit c8e2036

Please sign in to comment.