aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/workqueue.h48
1 files changed, 23 insertions, 25 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 49a9c51f9ee3..e84ebb69607d 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -133,26 +133,20 @@ struct execute_work {
133 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ 133 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \
134 } 134 }
135 135
136#define __DELAYED_WORK_INITIALIZER(n, f) { \ 136#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
137 .work = __WORK_INITIALIZER((n).work, (f)), \ 137 .work = __WORK_INITIALIZER((n).work, (f)), \
138 .timer = TIMER_INITIALIZER(delayed_work_timer_fn, \ 138 .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \
139 0, (unsigned long)&(n)), \ 139 0, (unsigned long)&(n), (tflags)), \
140 }
141
142#define __DEFERRABLE_WORK_INITIALIZER(n, f) { \
143 .work = __WORK_INITIALIZER((n).work, (f)), \
144 .timer = TIMER_DEFERRED_INITIALIZER(delayed_work_timer_fn, \
145 0, (unsigned long)&(n)), \
146 } 140 }
147 141
148#define DECLARE_WORK(n, f) \ 142#define DECLARE_WORK(n, f) \
149 struct work_struct n = __WORK_INITIALIZER(n, f) 143 struct work_struct n = __WORK_INITIALIZER(n, f)
150 144
151#define DECLARE_DELAYED_WORK(n, f) \ 145#define DECLARE_DELAYED_WORK(n, f) \
152 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f) 146 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
153 147
154#define DECLARE_DEFERRABLE_WORK(n, f) \ 148#define DECLARE_DEFERRABLE_WORK(n, f) \
155 struct delayed_work n = __DEFERRABLE_WORK_INITIALIZER(n, f) 149 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
156 150
157/* 151/*
158 * initialize a work item's function pointer 152 * initialize a work item's function pointer
@@ -216,29 +210,33 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
216 __INIT_WORK((_work), (_func), 1); \ 210 __INIT_WORK((_work), (_func), 1); \
217 } while (0) 211 } while (0)
218 212
219#define INIT_DELAYED_WORK(_work, _func) \ 213#define __INIT_DELAYED_WORK(_work, _func, _tflags) \
220 do { \ 214 do { \
221 INIT_WORK(&(_work)->work, (_func)); \ 215 INIT_WORK(&(_work)->work, (_func)); \
222 init_timer(&(_work)->timer); \ 216 __setup_timer(&(_work)->timer, delayed_work_timer_fn, \
223 (_work)->timer.function = delayed_work_timer_fn; \ 217 (unsigned long)(_work), (_tflags)); \
224 (_work)->timer.data = (unsigned long)(_work); \
225 } while (0) 218 } while (0)
226 219
227#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \ 220#define __INIT_DELAYED_WORK_ONSTACK(_work, _func, _tflags) \
228 do { \ 221 do { \
229 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ 222 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \
230 init_timer_on_stack(&(_work)->timer); \ 223 __setup_timer_on_stack(&(_work)->timer, \
231 (_work)->timer.function = delayed_work_timer_fn; \ 224 delayed_work_timer_fn, \
232 (_work)->timer.data = (unsigned long)(_work); \ 225 (unsigned long)(_work), \
226 (_tflags)); \
233 } while (0) 227 } while (0)
234 228
229#define INIT_DELAYED_WORK(_work, _func) \
230 __INIT_DELAYED_WORK(_work, _func, 0)
231
232#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \
233 __INIT_DELAYED_WORK_ONSTACK(_work, _func, 0)
234
235#define INIT_DEFERRABLE_WORK(_work, _func) \ 235#define INIT_DEFERRABLE_WORK(_work, _func) \
236 do { \ 236 __INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE)
237 INIT_WORK(&(_work)->work, (_func)); \ 237
238 init_timer_deferrable(&(_work)->timer); \ 238#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func) \
239 (_work)->timer.function = delayed_work_timer_fn; \ 239 __INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)
240 (_work)->timer.data = (unsigned long)(_work); \
241 } while (0)
242 240
243/** 241/**
244 * work_pending - Find out whether a work item is currently pending 242 * work_pending - Find out whether a work item is currently pending