aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/thread.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-29 13:48:48 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-29 13:48:48 -0400
commite389f9aec689209724105ae80a6c91fd2e747bc9 (patch)
tree3cc88a3e785e4f2ffeaa9dad0da695cfa437d4fe /drivers/net/wireless/libertas/thread.h
parentf73b0a08eae0e28c50db5dd5ab8245546918bfb6 (diff)
parentb4cf205846463a0a23a917bb18ad833bc9a8c0bb (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (107 commits) smc911x: fix compilation breakage wjen debug is on [netdrvr] eexpress: minor corrections add NAPI support to sb1250-mac.c ixgb: ROUND_UP macro cleanup in drivers/net/ixgb e1000: ROUND_UP macro cleanup in drivers/net/e1000 Generic HDLC sparse annotations e100: Optionally use I/O mode only to access register space e100: allow bad MAC address when running with invalid eeprom csum ehea: fix for dlpar support ehea: fix for sysfs entries 3C509: Remove unnecessary include of <linux/pm_legacy.h> NetXen: Fix for vmalloc issues NetXen: Fixes for Power PC architecture NetXen: Port swap feature for multi port cards NetXen: Removal of redundant macros NetXen: Multi PCI support for Quad cards NetXen: Removal of redundant argument passing NetXen: Use multiple PCI functions [netdrvr e100] experiment with doing RX in a similar manner to eepro100 [PATCH] ieee80211: add missing global needed by IEEE80211_DEBUG_XXXX ...
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 000000000000..207b8a6cc33d
--- /dev/null
+++ b/drivers/net/wireless/libertas/thread.h
@@ -0,0 +1,52 @@
1#ifndef __WLAN_THREAD_H_
2#define __WLAN_THREAD_H_
3
4#include <linux/kthread.h>
5
6struct wlan_thread {
7 struct task_struct *task;
8 wait_queue_head_t waitq;
9 pid_t pid;
10 void *priv;
11};
12
13static inline void wlan_activate_thread(struct wlan_thread * thr)
14{
15 /** Record the thread pid */
16 thr->pid = current->pid;
17
18 /** Initialize the wait queue */
19 init_waitqueue_head(&thr->waitq);
20}
21
22static inline void wlan_deactivate_thread(struct wlan_thread * thr)
23{
24 ENTER();
25
26 thr->pid = 0;
27
28 LEAVE();
29}
30
31static inline void wlan_create_thread(int (*wlanfunc) (void *),
32 struct wlan_thread * thr, char *name)
33{
34 thr->task = kthread_run(wlanfunc, thr, "%s", name);
35}
36
37static inline int wlan_terminate_thread(struct wlan_thread * thr)
38{
39 ENTER();
40
41 /* Check if the thread is active or not */
42 if (!thr->pid) {
43 printk(KERN_ERR "Thread does not exist\n");
44 return -1;
45 }
46 kthread_stop(thr->task);
47
48 LEAVE();
49 return 0;
50}
51
52#endif