All of lore.kernel.org
 help / color / mirror / Atom feed
From: <Ajay.Kathat@microchip.com>
To: <linux-wireless@vger.kernel.org>
Cc: <Claudiu.Beznea@microchip.com>, <Ajay.Kathat@microchip.com>
Subject: [PATCH 01/12] wilc1000: move 'deinit_lock' lock init/destory inside module probe
Date: Fri, 23 Apr 2021 18:29:41 +0000	[thread overview]
Message-ID: <20210423182925.5865-2-ajay.kathat@microchip.com> (raw)
In-Reply-To: <20210423182925.5865-1-ajay.kathat@microchip.com>

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

Move initialization & deinitialization of 'deinit_lock' mutex lock
inside driver init and deinit respectively alongside other locks
initialization. After following changes no need to maintain client count
variable(client_count) just to init/destroy the lock.

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

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

  parent reply	other threads:[~2021-04-23 18:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 18:29 [PATCH 00/12] wilc1000: added chip wakeup support and few fixes Ajay.Kathat
2021-04-23 18:29 ` [PATCH 02/12] wilc1000: fix possible memory leak in cfg_scan_result() Ajay.Kathat
2021-04-23 18:29 ` Ajay.Kathat [this message]
2021-06-24  5:43   ` [PATCH 01/12] wilc1000: move 'deinit_lock' lock init/destory inside module probe Ajay.Kathat
2021-06-24  5:55     ` Kalle Valo
2021-04-23 18:29 ` [PATCH 03/12] wilc1000: added new WID to pass WOW info to firmware Ajay.Kathat
2021-06-24  9:25   ` Kalle Valo
2021-06-24 11:00     ` Ajay.Kathat
2021-04-23 18:29 ` [PATCH 04/12] wilc1000: setup registers to support chip wakeup sequence Ajay.Kathat
2021-06-24  9:27   ` Kalle Valo
2021-04-23 18:29 ` [PATCH 05/12] wilc1000: add reset/terminate/repeat command support for SPI bus Ajay.Kathat
2021-06-24  9:28   ` Kalle Valo
2021-04-23 18:29 ` [PATCH 06/12] wilc1000: handle register read fail issue " Ajay.Kathat
2021-04-23 18:29 ` [PATCH 07/12] wilc1000: ignore error response for SPI clockless registers Ajay.Kathat
2021-04-23 18:29 ` [PATCH 08/12] wilc1000: invoke chip reset register while FW download Ajay.Kathat
2021-06-24  9:32   ` Kalle Valo
2021-04-23 18:29 ` [PATCH 09/12] wilc1000: avoid 'isinit' static by moving inside priv data Ajay.Kathat
2021-06-24  9:40   ` Kalle Valo
2021-04-23 18:29 ` [PATCH 11/12] wilc1000: use write command after read in wilc_spi_sync_ext() Ajay.Kathat
2021-06-24  9:42   ` Kalle Valo
2021-04-23 18:29 ` [PATCH 10/12] wilc1000: added initialized variable check before processing Ajay.Kathat
2021-06-24  9:41   ` Kalle Valo
2021-04-23 18:29 ` [PATCH 12/12] wilc1000: increase WILC_CFG_PKTS_TIMEOUT timeout value Ajay.Kathat
2021-06-24  9:42   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210423182925.5865-2-ajay.kathat@microchip.com \
    --to=ajay.kathat@microchip.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.