datapath: Fix build with backported netdev_alloc_skb_ip_align()
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / linux / workqueue.h
1 #ifndef __LINUX_WORKQUEUE_WRAPPER_H
2 #define __LINUX_WORKQUEUE_WRAPPER_H 1
3
4 #include_next <linux/workqueue.h>
5
6 #include <linux/version.h>
7 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
8
9 #ifdef __KERNEL__
10 /*
11  * initialize a work-struct's func and data pointers:
12  */
13 #undef PREPARE_WORK
14 #define PREPARE_WORK(_work, _func)                              \
15         do {                                                    \
16                 (_work)->func = (void(*)(void*)) _func;         \
17                 (_work)->data = _work;                          \
18         } while (0)
19
20 /*
21  * initialize all of a work-struct:
22  */
23 #undef INIT_WORK
24 #define INIT_WORK(_work, _func)                                 \
25         do {                                                    \
26                 INIT_LIST_HEAD(&(_work)->entry);                \
27                 (_work)->pending = 0;                           \
28                 PREPARE_WORK((_work), (_func));                 \
29                 init_timer(&(_work)->timer);                    \
30         } while (0)
31
32 #endif /* __KERNEL__ */
33
34 #endif /* linux kernel < 2.6.20 */
35
36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
37 /* There is no equivalent to cancel_work_sync() so just flush all
38  * pending work. */
39 #define cancel_work_sync(_work) flush_scheduled_work()
40 #endif
41
42 #endif