]> err.no Git - linux-2.6/blobdiff - include/linux/hrtimer.h
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6] / include / linux / hrtimer.h
index 0e8f4762f6f8e8cc52cbedb920fa066523de0517..7d2a1b974c5edd4657d647a07b8c62416ae22476 100644 (file)
@@ -34,13 +34,7 @@ enum hrtimer_restart {
        HRTIMER_RESTART,
 };
 
-/*
- * Timer states:
- */
-enum hrtimer_state {
-       HRTIMER_INACTIVE,               /* Timer is inactive */
-       HRTIMER_PENDING,                /* Timer is pending */
-};
+#define HRTIMER_INACTIVE       ((void *)1UL)
 
 struct hrtimer_base;
 
@@ -51,9 +45,7 @@ struct hrtimer_base;
  * @expires:   the absolute expiry time in the hrtimers internal
  *             representation. The time is related to the clock on
  *             which the timer is based.
- * @state:     state of the timer
  * @function:  timer expiry callback function
- * @data:      argument for the callback function
  * @base:      pointer to the timer base (per cpu and per clock)
  *
  * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE()
@@ -61,12 +53,23 @@ struct hrtimer_base;
 struct hrtimer {
        struct rb_node          node;
        ktime_t                 expires;
-       enum hrtimer_state      state;
-       int                     (*function)(void *);
-       void                    *data;
+       int                     (*function)(struct hrtimer *);
        struct hrtimer_base     *base;
 };
 
+/**
+ * struct hrtimer_sleeper - simple sleeper structure
+ *
+ * @timer:     embedded timer structure
+ * @task:      task to wake up
+ *
+ * task is set to NULL, when the timer expires.
+ */
+struct hrtimer_sleeper {
+       struct hrtimer timer;
+       struct task_struct *task;
+};
+
 /**
  * struct hrtimer_base - the timer base for a specific clock
  *
@@ -77,7 +80,7 @@ struct hrtimer {
  * @first:             pointer to the timer node which expires first
  * @resolution:                the resolution of the clock, in nanoseconds
  * @get_time:          function to retrieve the current time of the clock
- * @get_sofirq_time:   function to retrieve the current time from the softirq
+ * @get_softirq_time:  function to retrieve the current time from the softirq
  * @curr_timer:                the timer which is executing a callback right now
  * @softirq_time:      the time when running the hrtimer queue in the softirq
  */
@@ -124,7 +127,7 @@ extern ktime_t hrtimer_get_next_event(void);
 
 static inline int hrtimer_active(const struct hrtimer *timer)
 {
-       return timer->state == HRTIMER_PENDING;
+       return rb_parent(&timer->node) != &timer->node;
 }
 
 /* Forward a hrtimer so it expires after now: */
@@ -137,6 +140,9 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
                              const enum hrtimer_mode mode,
                              const clockid_t clockid);
 
+extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
+                                struct task_struct *tsk);
+
 /* Soft interrupt function to run the hrtimer queues: */
 extern void hrtimer_run_queues(void);