]> asedeno.scripts.mit.edu Git - linux.git/blob - tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/workqueues.h
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / tools / testing / selftests / rcutorture / formal / srcu-cbmc / src / workqueues.h
1 #ifndef WORKQUEUES_H
2 #define WORKQUEUES_H
3
4 #include <stdbool.h>
5
6 #include "barriers.h"
7 #include "bug_on.h"
8 #include "int_typedefs.h"
9
10 #include <linux/types.h>
11
12 /* Stub workqueue implementation. */
13
14 struct work_struct;
15 typedef void (*work_func_t)(struct work_struct *work);
16 void delayed_work_timer_fn(unsigned long __data);
17
18 struct work_struct {
19 /*      atomic_long_t data; */
20         unsigned long data;
21
22         struct list_head entry;
23         work_func_t func;
24 #ifdef CONFIG_LOCKDEP
25         struct lockdep_map lockdep_map;
26 #endif
27 };
28
29 struct timer_list {
30         struct hlist_node       entry;
31         unsigned long           expires;
32         void                    (*function)(unsigned long);
33         unsigned long           data;
34         u32                     flags;
35         int                     slack;
36 };
37
38 struct delayed_work {
39         struct work_struct work;
40         struct timer_list timer;
41
42         /* target workqueue and CPU ->timer uses to queue ->work */
43         struct workqueue_struct *wq;
44         int cpu;
45 };
46
47
48 static inline bool schedule_work(struct work_struct *work)
49 {
50         BUG();
51         return true;
52 }
53
54 static inline bool schedule_work_on(int cpu, struct work_struct *work)
55 {
56         BUG();
57         return true;
58 }
59
60 static inline bool queue_work(struct workqueue_struct *wq,
61                               struct work_struct *work)
62 {
63         BUG();
64         return true;
65 }
66
67 static inline bool queue_delayed_work(struct workqueue_struct *wq,
68                                       struct delayed_work *dwork,
69                                       unsigned long delay)
70 {
71         BUG();
72         return true;
73 }
74
75 #define INIT_WORK(w, f) \
76         do { \
77                 (w)->data = 0; \
78                 (w)->func = (f); \
79         } while (0)
80
81 #define INIT_DELAYED_WORK(w, f) INIT_WORK(&(w)->work, (f))
82
83 #define __WORK_INITIALIZER(n, f) { \
84                 .data = 0, \
85                 .entry = { &(n).entry, &(n).entry }, \
86                 .func = f \
87         }
88
89 /* Don't bother initializing timer. */
90 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
91         .work = __WORK_INITIALIZER((n).work, (f)), \
92         }
93
94 #define DECLARE_WORK(n, f) \
95         struct workqueue_struct n = __WORK_INITIALIZER
96
97 #define DECLARE_DELAYED_WORK(n, f) \
98         struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
99
100 #define system_power_efficient_wq ((struct workqueue_struct *) NULL)
101
102 #endif