diff mbox series

[v2,01/11] wilc1000: move 'deinit_lock' lock init/destroy inside module probe

Message ID 20210916164902.74629-2-ajay.kathat@microchip.com
State New
Headers show
Series wilc1000: add chip wakeup support and few fixes | expand

Commit Message

Ajay Singh Sept. 16, 2021, 4:49 p.m. UTC
From: Ajay Singh <ajay.kathat@microchip.com>

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>
---
 drivers/net/wireless/microchip/wilc1000/cfg80211.c | 2 ++
 drivers/net/wireless/microchip/wilc1000/hif.c      | 7 -------
 drivers/net/wireless/microchip/wilc1000/netdev.h   | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

Comments

Kalle Valo Sept. 21, 2021, 3:08 p.m. UTC | #1
<Ajay.Kathat@microchip.com> wrote:

> From: Ajay Singh <ajay.kathat@microchip.com>

> 

> 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>


11 patches applied to wireless-drivers-next.git, thanks.

c8e2036ee90b wilc1000: move 'deinit_lock' lock init/destroy inside module probe
3c719fed0f3a wilc1000: fix possible memory leak in cfg_scan_result()
0ec5408cd448 wilc1000: add new WID to pass wake_enable information to firmware
5bb9de8bcb18 wilc1000: configure registers to handle chip wakeup sequence
1bcc0879c963 wilc1000: add reset/terminate/repeat command support for SPI bus
c2dcb4766bcb wilc1000: handle read failure issue for clockless registers
aa3fda4fcf63 wilc1000: ignore clockless registers status response for SPI
29f7393e02ac wilc1000: invoke chip reset register before firmware download
cd50248de35b wilc1000: add 'initialized' flag check before adding an element to TX queue
301cfbab09fd wilc1000: use correct write command sequence in wilc_spi_sync_ext()
bb6a0d5404aa wilc1000: increase config packets response wait timeout limit

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210916164902.74629-2-ajay.kathat@microchip.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
diff mbox series

Patch

diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
index 96973ec7bd9a..530a768547cc 100644
--- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -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);
@@ -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);
 }
 
diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c
index a133736a7821..497a49a182ef 100644
--- a/drivers/net/wireless/microchip/wilc1000/hif.c
+++ b/drivers/net/wireless/microchip/wilc1000/hif.c
@@ -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)
@@ -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));
 
@@ -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;
 }
 
@@ -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;
 }
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index 86209b391a3d..a39c62a20f04 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -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;