diff options
Diffstat (limited to 'include/linux/workqueue.h')
| -rw-r--r-- | include/linux/workqueue.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index b36291130f22..13e1adf55c4c 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -41,6 +41,11 @@ struct delayed_work { | |||
| 41 | struct timer_list timer; | 41 | struct timer_list timer; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | static inline struct delayed_work *to_delayed_work(struct work_struct *work) | ||
| 45 | { | ||
| 46 | return container_of(work, struct delayed_work, work); | ||
| 47 | } | ||
| 48 | |||
| 44 | struct execute_work { | 49 | struct execute_work { |
| 45 | struct work_struct work; | 50 | struct work_struct work; |
| 46 | }; | 51 | }; |
| @@ -118,12 +123,24 @@ struct execute_work { | |||
| 118 | init_timer(&(_work)->timer); \ | 123 | init_timer(&(_work)->timer); \ |
| 119 | } while (0) | 124 | } while (0) |
| 120 | 125 | ||
| 126 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | ||
| 127 | do { \ | ||
| 128 | INIT_WORK(&(_work)->work, (_func)); \ | ||
| 129 | init_timer_on_stack(&(_work)->timer); \ | ||
| 130 | } while (0) | ||
| 131 | |||
| 121 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ | 132 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ |
| 122 | do { \ | 133 | do { \ |
| 123 | INIT_WORK(&(_work)->work, (_func)); \ | 134 | INIT_WORK(&(_work)->work, (_func)); \ |
| 124 | init_timer_deferrable(&(_work)->timer); \ | 135 | init_timer_deferrable(&(_work)->timer); \ |
| 125 | } while (0) | 136 | } while (0) |
| 126 | 137 | ||
| 138 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | ||
| 139 | do { \ | ||
| 140 | INIT_WORK(&(_work)->work, (_func)); \ | ||
| 141 | init_timer_on_stack(&(_work)->timer); \ | ||
| 142 | } while (0) | ||
| 143 | |||
| 127 | /** | 144 | /** |
| 128 | * work_pending - Find out whether a work item is currently pending | 145 | * work_pending - Find out whether a work item is currently pending |
| 129 | * @work: The work item in question | 146 | * @work: The work item in question |
