aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/workqueue.h126
1 files changed, 63 insertions, 63 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1ce3fb08308d..26c5b4c63861 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -126,43 +126,43 @@ struct execute_work {
126#define __WORK_INIT_LOCKDEP_MAP(n, k) 126#define __WORK_INIT_LOCKDEP_MAP(n, k)
127#endif 127#endif
128 128
129#define __WORK_INITIALIZER(n, f) { \ 129#define __WORK_INITIALIZER(n, f) { \
130 .data = WORK_DATA_STATIC_INIT(), \ 130 .data = WORK_DATA_STATIC_INIT(), \
131 .entry = { &(n).entry, &(n).entry }, \ 131 .entry = { &(n).entry, &(n).entry }, \
132 .func = (f), \ 132 .func = (f), \
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) { \
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)), \
140 } 140 }
141 141
142#define __DEFERRED_WORK_INITIALIZER(n, f) { \ 142#define __DEFERRED_WORK_INITIALIZER(n, f) { \
143 .work = __WORK_INITIALIZER((n).work, (f)), \ 143 .work = __WORK_INITIALIZER((n).work, (f)), \
144 .timer = TIMER_DEFERRED_INITIALIZER(delayed_work_timer_fn, \ 144 .timer = TIMER_DEFERRED_INITIALIZER(delayed_work_timer_fn, \
145 0, (unsigned long)&(n)), \ 145 0, (unsigned long)&(n)), \
146 } 146 }
147 147
148#define DECLARE_WORK(n, f) \ 148#define DECLARE_WORK(n, f) \
149 struct work_struct n = __WORK_INITIALIZER(n, f) 149 struct work_struct n = __WORK_INITIALIZER(n, f)
150 150
151#define DECLARE_DELAYED_WORK(n, f) \ 151#define DECLARE_DELAYED_WORK(n, f) \
152 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f) 152 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f)
153 153
154#define DECLARE_DEFERRED_WORK(n, f) \ 154#define DECLARE_DEFERRED_WORK(n, f) \
155 struct delayed_work n = __DEFERRED_WORK_INITIALIZER(n, f) 155 struct delayed_work n = __DEFERRED_WORK_INITIALIZER(n, f)
156 156
157/* 157/*
158 * initialize a work item's function pointer 158 * initialize a work item's function pointer
159 */ 159 */
160#define PREPARE_WORK(_work, _func) \ 160#define PREPARE_WORK(_work, _func) \
161 do { \ 161 do { \
162 (_work)->func = (_func); \ 162 (_work)->func = (_func); \
163 } while (0) 163 } while (0)
164 164
165#define PREPARE_DELAYED_WORK(_work, _func) \ 165#define PREPARE_DELAYED_WORK(_work, _func) \
166 PREPARE_WORK(&(_work)->work, (_func)) 166 PREPARE_WORK(&(_work)->work, (_func))
167 167
168#ifdef CONFIG_DEBUG_OBJECTS_WORK 168#ifdef CONFIG_DEBUG_OBJECTS_WORK
@@ -192,7 +192,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
192 \ 192 \
193 __init_work((_work), _onstack); \ 193 __init_work((_work), _onstack); \
194 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 194 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
195 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ 195 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0); \
196 INIT_LIST_HEAD(&(_work)->entry); \ 196 INIT_LIST_HEAD(&(_work)->entry); \
197 PREPARE_WORK((_work), (_func)); \ 197 PREPARE_WORK((_work), (_func)); \
198 } while (0) 198 } while (0)
@@ -206,38 +206,38 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
206 } while (0) 206 } while (0)
207#endif 207#endif
208 208
209#define INIT_WORK(_work, _func) \ 209#define INIT_WORK(_work, _func) \
210 do { \ 210 do { \
211 __INIT_WORK((_work), (_func), 0); \ 211 __INIT_WORK((_work), (_func), 0); \
212 } while (0) 212 } while (0)
213 213
214#define INIT_WORK_ONSTACK(_work, _func) \ 214#define INIT_WORK_ONSTACK(_work, _func) \
215 do { \ 215 do { \
216 __INIT_WORK((_work), (_func), 1); \ 216 __INIT_WORK((_work), (_func), 1); \
217 } while (0) 217 } while (0)
218 218
219#define INIT_DELAYED_WORK(_work, _func) \ 219#define INIT_DELAYED_WORK(_work, _func) \
220 do { \ 220 do { \
221 INIT_WORK(&(_work)->work, (_func)); \ 221 INIT_WORK(&(_work)->work, (_func)); \
222 init_timer(&(_work)->timer); \ 222 init_timer(&(_work)->timer); \
223 (_work)->timer.function = delayed_work_timer_fn;\ 223 (_work)->timer.function = delayed_work_timer_fn; \
224 (_work)->timer.data = (unsigned long)(_work); \ 224 (_work)->timer.data = (unsigned long)(_work); \
225 } while (0) 225 } while (0)
226 226
227#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \ 227#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \
228 do { \ 228 do { \
229 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ 229 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \
230 init_timer_on_stack(&(_work)->timer); \ 230 init_timer_on_stack(&(_work)->timer); \
231 (_work)->timer.function = delayed_work_timer_fn;\ 231 (_work)->timer.function = delayed_work_timer_fn; \
232 (_work)->timer.data = (unsigned long)(_work); \ 232 (_work)->timer.data = (unsigned long)(_work); \
233 } while (0) 233 } while (0)
234 234
235#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ 235#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \
236 do { \ 236 do { \
237 INIT_WORK(&(_work)->work, (_func)); \ 237 INIT_WORK(&(_work)->work, (_func)); \
238 init_timer_deferrable(&(_work)->timer); \ 238 init_timer_deferrable(&(_work)->timer); \
239 (_work)->timer.function = delayed_work_timer_fn;\ 239 (_work)->timer.function = delayed_work_timer_fn; \
240 (_work)->timer.data = (unsigned long)(_work); \ 240 (_work)->timer.data = (unsigned long)(_work); \
241 } while (0) 241 } while (0)
242 242
243/** 243/**
@@ -345,22 +345,22 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
345 * Pointer to the allocated workqueue on success, %NULL on failure. 345 * Pointer to the allocated workqueue on success, %NULL on failure.
346 */ 346 */
347#ifdef CONFIG_LOCKDEP 347#ifdef CONFIG_LOCKDEP
348#define alloc_workqueue(fmt, flags, max_active, args...) \ 348#define alloc_workqueue(fmt, flags, max_active, args...) \
349({ \ 349({ \
350 static struct lock_class_key __key; \ 350 static struct lock_class_key __key; \
351 const char *__lock_name; \ 351 const char *__lock_name; \
352 \ 352 \
353 if (__builtin_constant_p(fmt)) \ 353 if (__builtin_constant_p(fmt)) \
354 __lock_name = (fmt); \ 354 __lock_name = (fmt); \
355 else \ 355 else \
356 __lock_name = #fmt; \ 356 __lock_name = #fmt; \
357 \ 357 \
358 __alloc_workqueue_key((fmt), (flags), (max_active), \ 358 __alloc_workqueue_key((fmt), (flags), (max_active), \
359 &__key, __lock_name, ##args); \ 359 &__key, __lock_name, ##args); \
360}) 360})
361#else 361#else
362#define alloc_workqueue(fmt, flags, max_active, args...) \ 362#define alloc_workqueue(fmt, flags, max_active, args...) \
363 __alloc_workqueue_key((fmt), (flags), (max_active), \ 363 __alloc_workqueue_key((fmt), (flags), (max_active), \
364 NULL, NULL, ##args) 364 NULL, NULL, ##args)
365#endif 365#endif
366 366
@@ -377,14 +377,14 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
377 * RETURNS: 377 * RETURNS:
378 * Pointer to the allocated workqueue on success, %NULL on failure. 378 * Pointer to the allocated workqueue on success, %NULL on failure.
379 */ 379 */
380#define alloc_ordered_workqueue(fmt, flags, args...) \ 380#define alloc_ordered_workqueue(fmt, flags, args...) \
381 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args) 381 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args)
382 382
383#define create_workqueue(name) \ 383#define create_workqueue(name) \
384 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 384 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
385#define create_freezable_workqueue(name) \ 385#define create_freezable_workqueue(name) \
386 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 386 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
387#define create_singlethread_workqueue(name) \ 387#define create_singlethread_workqueue(name) \
388 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 388 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
389 389
390extern void destroy_workqueue(struct workqueue_struct *wq); 390extern void destroy_workqueue(struct workqueue_struct *wq);