diff options
| author | Jean Delvare <[email protected]> | 2009-04-02 16:56:54 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2009-04-02 19:04:50 -0700 |
| commit | bf6aede712334d7338d5c47a5ee5ba3883c82a61 (patch) | |
| tree | 153483c5ef1de41f8dd3d233ba46117d0676c303 /include/linux | |
| parent | e4c2ff1cf2d7fc65d0fc6f88bc98338e0212ad52 (diff) | |
workqueue: add to_delayed_work() helper function
It is a fairly common operation to have a pointer to a work and to need a
pointer to the delayed work it is contained in. In particular, all
delayed works which want to rearm themselves will have to do that. So it
would seem fair to offer a helper function for this operation.
[[email protected]: coding-style fixes]
Signed-off-by: Jean Delvare <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Pekka Enberg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/workqueue.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 3cd51e579ab1..13e1adf55c4c 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -41,6 +41,11 @@ struct delayed_work { struct timer_list timer; }; +static inline struct delayed_work *to_delayed_work(struct work_struct *work) +{ + return container_of(work, struct delayed_work, work); +} + struct execute_work { struct work_struct work; }; |