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)
53 flush_workqueue(system_wq);
55 EXPORT_SYMBOL_GPL(flush_scheduled_work);
58 * work_busy - test whether a work is currently pending or running
59 * @work: the work to be tested
61 * Test whether @work is currently pending or running. There is no
62 * synchronization around this function and the test result is
63 * unreliable and only useful as advisory hints or for debugging.
64 * Especially for reentrant wqs, the pending state might hide the
68 * OR'd bitmask of WORK_BUSY_* bits.
70 unsigned int work_busy(struct work_struct *work)
74 if (work_pending(work))
75 ret |= WORK_BUSY_PENDING;
79 EXPORT_SYMBOL_GPL(work_busy);
81 int backport_system_workqueue_create()
83 system_wq = alloc_workqueue("events", 0, 0);
87 system_long_wq = alloc_workqueue("events_long", 0, 0);
91 system_nrt_wq = create_singlethread_workqueue("events_nrt");
98 destroy_workqueue(system_long_wq);
100 destroy_workqueue(system_wq);
104 void backport_system_workqueue_destroy()
106 destroy_workqueue(system_nrt_wq);
107 destroy_workqueue(system_wq);
108 destroy_workqueue(system_long_wq);