]> err.no Git - linux-2.6/blobdiff - kernel/hrtimer.c
[PATCH] do_notify_parent_cldstop: remove 'to_self' param
[linux-2.6] / kernel / hrtimer.c
index 59ec50c1e90533649e1c5e8cdb7814167a113cc2..0237a556eb1f03ab69b1187ce046ed5b6793d7de 100644 (file)
@@ -266,7 +266,7 @@ ktime_t ktime_add_ns(const ktime_t kt, u64 nsec)
 /*
  * Divide a ktime value by a nanosecond value
  */
-static unsigned long ktime_divns(const ktime_t kt, nsec_t div)
+static unsigned long ktime_divns(const ktime_t kt, s64 div)
 {
        u64 dclc, inc, dns;
        int sft = 0;
@@ -322,7 +322,7 @@ hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
                interval.tv64 = timer->base->resolution.tv64;
 
        if (unlikely(delta.tv64 >= interval.tv64)) {
-               nsec_t incr = ktime_to_ns(interval);
+               s64 incr = ktime_to_ns(interval);
 
                orun = ktime_divns(delta, incr);
                timer->expires = ktime_add_ns(timer->expires, incr * orun);
@@ -374,8 +374,6 @@ static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base)
        rb_link_node(&timer->node, parent, link);
        rb_insert_color(&timer->node, &base->active);
 
-       timer->state = HRTIMER_PENDING;
-
        if (!base->first || timer->expires.tv64 <
            rb_entry(base->first, struct hrtimer, node)->expires.tv64)
                base->first = &timer->node;
@@ -395,6 +393,7 @@ static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base)
        if (base->first == &timer->node)
                base->first = rb_next(&timer->node);
        rb_erase(&timer->node, &base->active);
+       timer->node.rb_parent = HRTIMER_INACTIVE;
 }
 
 /*
@@ -405,7 +404,6 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base)
 {
        if (hrtimer_active(timer)) {
                __remove_hrtimer(timer, base);
-               timer->state = HRTIMER_INACTIVE;
                return 1;
        }
        return 0;
@@ -579,6 +577,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
                clock_id = CLOCK_MONOTONIC;
 
        timer->base = &bases[clock_id];
+       timer->node.rb_parent = HRTIMER_INACTIVE;
 }
 
 /**
@@ -614,31 +613,26 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base)
 
        while ((node = base->first)) {
                struct hrtimer *timer;
-               int (*fn)(void *);
+               int (*fn)(struct hrtimer *);
                int restart;
-               void *data;
 
                timer = rb_entry(node, struct hrtimer, node);
                if (base->softirq_time.tv64 <= timer->expires.tv64)
                        break;
 
                fn = timer->function;
-               data = timer->data;
                set_curr_timer(base, timer);
-               timer->state = HRTIMER_INACTIVE;
                __remove_hrtimer(timer, base);
                spin_unlock_irq(&base->lock);
 
-               restart = fn(data);
+               restart = fn(timer);
 
                spin_lock_irq(&base->lock);
 
-               /* Another CPU has added back the timer */
-               if (timer->state != HRTIMER_INACTIVE)
-                       continue;
-
-               if (restart != HRTIMER_NORESTART)
+               if (restart != HRTIMER_NORESTART) {
+                       BUG_ON(hrtimer_active(timer));
                        enqueue_hrtimer(timer, base);
+               }
        }
        set_curr_timer(base, NULL);
        spin_unlock_irq(&base->lock);
@@ -668,9 +662,10 @@ struct sleep_hrtimer {
        int expired;
 };
 
-static int nanosleep_wakeup(void *data)
+static int nanosleep_wakeup(struct hrtimer *timer)
 {
-       struct sleep_hrtimer *t = data;
+       struct sleep_hrtimer *t =
+               container_of(timer, struct sleep_hrtimer, timer);
 
        t->expired = 1;
        wake_up_process(t->task);
@@ -681,7 +676,6 @@ static int nanosleep_wakeup(void *data)
 static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode)
 {
        t->timer.function = nanosleep_wakeup;
-       t->timer.data = t;
        t->task = current;
        t->expired = 0;