1 #ifndef __LINUX_WORKQUEUE_WRAPPER_H
2 #define __LINUX_WORKQUEUE_WRAPPER_H 1
4 #include_next <linux/workqueue.h>
6 #include <linux/version.h>
7 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
11 * initialize a work-struct's func and data pointers:
14 #define PREPARE_WORK(_work, _func) \
16 (_work)->func = (void(*)(void*)) _func; \
17 (_work)->data = _work; \
21 * initialize all of a work-struct:
24 #define INIT_WORK(_work, _func) \
26 INIT_LIST_HEAD(&(_work)->entry); \
27 (_work)->pending = 0; \
28 PREPARE_WORK((_work), (_func)); \
29 init_timer(&(_work)->timer); \
32 #endif /* __KERNEL__ */
34 #endif /* linux kernel < 2.6.20 */
36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
37 /* There is no equivalent to cancel_work_sync() so just flush all
39 #define cancel_work_sync(_work) flush_scheduled_work()