2 * Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * Compatibility file for Linux wireless for kernels 2.6.36.
11 #include <linux/compat.h>
13 struct workqueue_struct *system_wq __read_mostly;
14 struct workqueue_struct *system_long_wq __read_mostly;
15 struct workqueue_struct *system_nrt_wq __read_mostly;
16 EXPORT_SYMBOL_GPL(system_wq);
17 EXPORT_SYMBOL_GPL(system_long_wq);
18 EXPORT_SYMBOL_GPL(system_nrt_wq);
20 int schedule_work(struct work_struct *work)
22 return queue_work(system_wq, work);
24 EXPORT_SYMBOL_GPL(schedule_work);
26 int schedule_work_on(int cpu, struct work_struct *work)
28 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
29 return queue_work_on(cpu, system_wq, work);
31 return queue_work(system_wq, work);
34 EXPORT_SYMBOL_GPL(schedule_work_on);
36 int schedule_delayed_work(struct delayed_work *dwork,
39 return queue_delayed_work(system_wq, dwork, delay);
41 EXPORT_SYMBOL_GPL(schedule_delayed_work);
43 int schedule_delayed_work_on(int cpu,
44 struct delayed_work *dwork,
47 return queue_delayed_work_on(cpu, system_wq, dwork, delay);
49 EXPORT_SYMBOL_GPL(schedule_delayed_work_on);
51 void flush_scheduled_work(void)
54 * It is debatable which one we should prioritize first, lets
55 * go with the old kernel's one first for now (keventd_wq) and
56 * if think its reasonable later we can flip this around.
58 flush_workqueue(system_wq);
59 flush_scheduled_work();
61 EXPORT_SYMBOL_GPL(flush_scheduled_work);
64 * work_busy - test whether a work is currently pending or running
65 * @work: the work to be tested
67 * Test whether @work is currently pending or running. There is no
68 * synchronization around this function and the test result is
69 * unreliable and only useful as advisory hints or for debugging.
70 * Especially for reentrant wqs, the pending state might hide the
74 * OR'd bitmask of WORK_BUSY_* bits.
76 unsigned int work_busy(struct work_struct *work)
80 if (work_pending(work))
81 ret |= WORK_BUSY_PENDING;
85 EXPORT_SYMBOL_GPL(work_busy);
87 int backport_system_workqueue_create()
89 system_wq = alloc_workqueue("events", 0, 0);
93 system_long_wq = alloc_workqueue("events_long", 0, 0);
97 system_nrt_wq = create_singlethread_workqueue("events_nrt");
104 destroy_workqueue(system_long_wq);
106 destroy_workqueue(system_wq);
110 void backport_system_workqueue_destroy()
112 destroy_workqueue(system_nrt_wq);
113 destroy_workqueue(system_wq);
114 destroy_workqueue(system_long_wq);