Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1420692

[PATCH 5/7] staging: wilc1000: Replace semaphore close_exit_sync with completion

From Binoy Jayan <binoy.jayan@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 5/7] staging: wilc1000: Replace semaphore close_exit_sync with completion
Date 2016-06-13 12:40 +0200
Message-ID <rJxrH-52s-13@gated-at.bofh.it> (permalink)
References <rJxrH-52s-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The semaphore 'close_exit_sync' is used as completion, so convert
it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
---
 drivers/staging/wilc1000/linux_wlan.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 39fe350..ac537c7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -31,7 +31,7 @@ static struct notifier_block g_dev_notifier = {
 	.notifier_call = dev_state_ev_handler
 };
 
-static struct semaphore close_exit_sync;
+static struct completion close_exit_sync;
 
 static int wlan_deinit_locks(struct net_device *dev);
 static void wlan_deinitialize_threads(struct net_device *dev);
@@ -1088,7 +1088,7 @@ int wilc_mac_close(struct net_device *ndev)
 		WILC_WFI_deinit_mon_interface();
 	}
 
-	up(&close_exit_sync);
+	complete(&close_exit_sync);
 	vif->mac_opened = 0;
 
 	return 0;
@@ -1232,7 +1232,8 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 	}
 
 	if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) {
-		wilc_lock_timeout(wilc, &close_exit_sync, 5 * 1000);
+		wait_for_completion_timeout(&close_exit_sync,
+						msecs_to_jiffies(5000));
 
 		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
 			if (wilc->vif[i]->ndev)
@@ -1258,7 +1259,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 	struct net_device *ndev;
 	struct wilc *wl;
 
-	sema_init(&close_exit_sync, 0);
+	init_completion(&close_exit_sync);
 
 	wl = kzalloc(sizeof(*wl), GFP_KERNEL);
 	if (!wl)
-- 
2.7.4

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 5/7] staging: wilc1000: Replace semaphore close_exit_sync with completion Binoy Jayan <binoy.jayan@linaro.org> - 2016-06-13 12:40 +0200
  Re: [PATCH 5/7] staging: wilc1000: Replace semaphore close_exit_sync with completion Arnd Bergmann <arnd@arndb.de> - 2016-06-13 15:50 +0200

csiph-web