linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Ajay.Kathat@microchip.com>
To: <linux-wireless@vger.kernel.org>
Cc: <devel@driverdev.osuosl.org>, <gregkh@linuxfoundation.org>,
	<Adham.Abozaeid@microchip.com>, <johannes@sipsolutions.net>,
	<Ajay.Kathat@microchip.com>
Subject: [PATCH 01/12] staging: wilc1000: remove use of 'terminated_handle' static variable
Date: Tue, 5 Feb 2019 07:15:31 +0000	[thread overview]
Message-ID: <1549350913-645-2-git-send-email-ajay.kathat@microchip.com> (raw)
In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com>

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

Remove use of 'terminated_handle' variable and set the 'hif_drv' to
NULL once it's free.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 3576834..97bf747 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -130,7 +130,6 @@ struct wilc_join_bss_param {
 	};
 } __packed;
 
-static struct host_if_drv *terminated_handle;
 static struct mutex hif_deinit_lock;
 
 /* 'msg' should be free by the caller for syc */
@@ -1478,6 +1477,9 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 	int result;
 	struct wilc_drv_handler drv;
 
+	if (!hif_drv)
+		return -EFAULT;
+
 	wid.id = WID_SET_DRV_HANDLER;
 	wid.type = WID_STR;
 	wid.size = sizeof(drv);
@@ -1699,8 +1701,6 @@ int wilc_deinit(struct wilc_vif *vif)
 
 	mutex_lock(&hif_deinit_lock);
 
-	terminated_handle = hif_drv;
-
 	del_timer_sync(&hif_drv->scan_timer);
 	del_timer_sync(&hif_drv->connect_timer);
 	del_timer_sync(&vif->periodic_rssi);
@@ -1717,9 +1717,8 @@ int wilc_deinit(struct wilc_vif *vif)
 	hif_drv->hif_state = HOST_IF_IDLE;
 
 	kfree(hif_drv);
-
+	vif->hif_drv = NULL;
 	vif->wilc->clients_count--;
-	terminated_handle = NULL;
 	mutex_unlock(&hif_deinit_lock);
 	return result;
 }
@@ -1738,7 +1737,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 		return;
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle) {
+	if (!hif_drv) {
 		netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv);
 		return;
 	}
@@ -1784,7 +1783,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle) {
+	if (!hif_drv) {
 		mutex_unlock(&hif_deinit_lock);
 		return;
 	}
@@ -1824,7 +1823,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)
 		return;
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle)
+	if (!hif_drv)
 		return;
 
 	if (hif_drv->usr_scan_req.scan_result) {
-- 
2.7.4


  reply	other threads:[~2019-02-05  7:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05  7:15 [PATCH 00/12] staging: wilc1000: changes to address mainline review comments Ajay.Kathat
2019-02-05  7:15 ` Ajay.Kathat [this message]
2019-02-05  7:15 ` [PATCH 02/12] staging: wilc1000: refactor linux_wlan_init_test_config() Ajay.Kathat
2019-02-05  7:15 ` [PATCH 03/12] staging: wilc1000: refactor code to use cookie information Ajay.Kathat
2019-02-05  7:15 ` [PATCH 04/12] staging: wilc1000: use random number for cookie instead of pointer Ajay.Kathat
2019-02-05  7:15 ` [PATCH 05/12] staging: wilc1000: avoid use of interface names for validation Ajay.Kathat
2019-02-05  7:15 ` [PATCH 06/12] staging: wilc1000: add check before performing operation on net_device Ajay.Kathat
2019-02-05  7:15 ` [PATCH 07/12] staging: wilc1000: remove unused struct 'add_sta_param' Ajay.Kathat
2019-02-05  7:15 ` [PATCH 08/12] staging: wilc1000: avoid use of 'hif_deinit_lock' static variable Ajay.Kathat
2019-02-05  7:15 ` [PATCH 09/12] staging: wilc1000: avoid use of static variable in linux_mon.c Ajay.Kathat
2019-02-05  7:15 ` [PATCH 10/12] staging: wilc1000: move static variable 'wlan_channel' to 'wilc' struct Ajay.Kathat
2019-02-05  7:16 ` [PATCH 11/12] staging: wilc1000: move 'curr_channel' static variable in " Ajay.Kathat
2019-02-05  7:16 ` [PATCH 12/12] staging: wilc1000: define p2p related static variable as constants Ajay.Kathat

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=1549350913-645-2-git-send-email-ajay.kathat@microchip.com \
    --to=ajay.kathat@microchip.com \
    --cc=Adham.Abozaeid@microchip.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes@sipsolutions.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).