Add to_delayed_work() to taskqueue.h
authorXiao Jia <stfairy@gmail.com>
Thu, 17 Sep 2015 00:02:21 +0000 (17:02 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 23 Sep 2015 20:46:27 +0000 (16:46 -0400)
kern/include/taskqueue.h

index 7b84926..4ae9bd4 100644 (file)
@@ -56,6 +56,11 @@ struct delayed_work {
        /* TODO: support for the actual alarm / timer */
 };
 
+static inline struct delayed_work *to_delayed_work(struct work_struct *work)
+{
+       return container_of(work, struct delayed_work, work);
+}
+
 #define INIT_DELAYED_WORK(dwp, funcp) (dwp)->work.func = (funcp)
 #define INIT_WORK(wp, funcp) (wp)->func = (funcp)
 void flush_workqueue(struct workqueue_struct *wq);