Commit 11a54b3f authored by Leo Kim's avatar Leo Kim Committed by Greg Kroah-Hartman

staging: wilc1000: txq_thread_started: replaces a semaphore with a completion

This patch replaces a semaphore(txq_thread_started) with a completion.
Struct semaphore txq_thread_started is used to signal completion of txq thread.
It is better to use completion than semaphore for this case.
Signed-off-by: default avatarLeo Kim <leo.kim@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 01c7cee9
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/semaphore.h> #include <linux/semaphore.h>
#include <linux/completion.h>
static int dev_state_ev_handler(struct notifier_block *this, static int dev_state_ev_handler(struct notifier_block *this,
unsigned long event, void *ptr); unsigned long event, void *ptr);
...@@ -313,12 +314,12 @@ static int linux_wlan_txq_task(void *vp) ...@@ -313,12 +314,12 @@ static int linux_wlan_txq_task(void *vp)
vif = netdev_priv(dev); vif = netdev_priv(dev);
wl = vif->wilc; wl = vif->wilc;
up(&wl->txq_thread_started); complete(&wl->txq_thread_started);
while (1) { while (1) {
down(&wl->txq_event); down(&wl->txq_event);
if (wl->close) { if (wl->close) {
up(&wl->txq_thread_started); complete(&wl->txq_thread_started);
while (!kthread_should_stop()) while (!kthread_should_stop())
schedule(); schedule();
...@@ -693,8 +694,7 @@ static int wlan_init_locks(struct net_device *dev) ...@@ -693,8 +694,7 @@ static int wlan_init_locks(struct net_device *dev)
sema_init(&wl->cfg_event, 0); sema_init(&wl->cfg_event, 0);
sema_init(&wl->sync_event, 0); sema_init(&wl->sync_event, 0);
init_completion(&wl->txq_thread_started);
sema_init(&wl->txq_thread_started, 0);
return 0; return 0;
} }
...@@ -731,7 +731,7 @@ static int wlan_initialize_threads(struct net_device *dev) ...@@ -731,7 +731,7 @@ static int wlan_initialize_threads(struct net_device *dev)
wilc->close = 0; wilc->close = 0;
return -ENOBUFS; return -ENOBUFS;
} }
down(&wilc->txq_thread_started); wait_for_completion(&wilc->txq_thread_started);
return 0; return 0;
} }
......
...@@ -179,8 +179,7 @@ struct wilc { ...@@ -179,8 +179,7 @@ struct wilc {
struct semaphore cfg_event; struct semaphore cfg_event;
struct semaphore sync_event; struct semaphore sync_event;
struct semaphore txq_event; struct semaphore txq_event;
struct completion txq_thread_started;
struct semaphore txq_thread_started;
struct task_struct *txq_thread; struct task_struct *txq_thread;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment