aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/libertas/thread.h
diff options
context:
space:
mode:
authorMarcelo Tosatti <marcelo@kvack.org>2007-02-10 12:25:27 -0200
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:00:54 -0400
commit876c9d3aeb989cf1961f2c228d309ba5dcfb1172 (patch)
tree239e9db92d13abc799c1ffc5304d8ec1503dbc61 /drivers/net/wireless/libertas/thread.h
parent35c3404efa7407811b706453f83d39b2539dcbd0 (diff)
[PATCH] Marvell Libertas 8388 802.11b/g USB driver
Add the Marvell Libertas 8388 802.11 USB driver. Signed-off-by: Marcelo Tosatti <marcelo@kvack.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/thread.h')
-rw-r--r--drivers/net/wireless/libertas/thread.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/thread.h b/drivers/net/wireless/libertas/thread.h
new file mode 100644
index 00000000000..207b8a6cc33
--- /dev/null
+++ b/drivers/net/wireless/libertas/thread.h
@@ -0,0 +1,52 @@
+#ifndef __WLAN_THREAD_H_
+#define __WLAN_THREAD_H_
+
+#include <linux/kthread.h>
+
+struct wlan_thread {
+ struct task_struct *task;
+ wait_queue_head_t waitq;
+ pid_t pid;
+ void *priv;
+};
+
+static inline void wlan_activate_thread(struct wlan_thread * thr)
+{
+ /** Record the thread pid */
+ thr->pid = current->pid;
+
+ /** Initialize the wait queue */
+ init_waitqueue_head(&thr->waitq);
+}
+
+static inline void wlan_deactivate_thread(struct wlan_thread * thr)
+{
+ ENTER();
+
+ thr->pid = 0;
+
+ LEAVE();
+}
+
+static inline void wlan_create_thread(int (*wlanfunc) (void *),
+ struct wlan_thread * thr, char *name)
+{
+ thr->task = kthread_run(wlanfunc, thr, "%s", name);
+}
+
+static inline int wlan_terminate_thread(struct wlan_thread * thr)
+{
+ ENTER();
+
+ /* Check if the thread is active or not */
+ if (!thr->pid) {
+ printk(KERN_ERR "Thread does not exist\n");
+ return -1;
+ }
+ kthread_stop(thr->task);
+
+ LEAVE();
+ return 0;
+}
+
+#endif