wl1251: set rate index and preamble flag on received packets
[pandora-kernel.git] / kernel / hrtimer.c
index 93976ad..0c8d7c0 100644 (file)
@@ -497,7 +497,7 @@ static inline int hrtimer_is_hres_enabled(void)
  */
 static inline int hrtimer_hres_active(void)
 {
-       return __get_cpu_var(hrtimer_bases).hres_active;
+       return __this_cpu_read(hrtimer_bases.hres_active);
 }
 
 /*
@@ -898,6 +898,7 @@ static inline int
 remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base)
 {
        if (hrtimer_is_queued(timer)) {
+               unsigned long state;
                int reprogram;
 
                /*
@@ -911,8 +912,13 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base)
                debug_deactivate(timer);
                timer_stats_hrtimer_clear_start_info(timer);
                reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases);
-               __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE,
-                                reprogram);
+               /*
+                * We must preserve the CALLBACK state flag here,
+                * otherwise we could move the timer base in
+                * switch_hrtimer_base.
+                */
+               state = timer->state & HRTIMER_STATE_CALLBACK;
+               __remove_hrtimer(timer, base, state, reprogram);
                return 1;
        }
        return 0;
@@ -1058,11 +1064,10 @@ EXPORT_SYMBOL_GPL(hrtimer_cancel);
  */
 ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
 {
-       struct hrtimer_clock_base *base;
        unsigned long flags;
        ktime_t rem;
 
-       base = lock_hrtimer_base(timer, &flags);
+       lock_hrtimer_base(timer, &flags);
        rem = hrtimer_expires_remaining(timer);
        unlock_hrtimer_base(timer, &flags);
 
@@ -1202,6 +1207,9 @@ static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)
                BUG_ON(timer->state != HRTIMER_STATE_CALLBACK);
                enqueue_hrtimer(timer, base);
        }
+
+       WARN_ON_ONCE(!(timer->state & HRTIMER_STATE_CALLBACK));
+
        timer->state &= ~HRTIMER_STATE_CALLBACK;
 }
 
@@ -1412,11 +1420,8 @@ void hrtimer_run_queues(void)
                return;
 
        for (index = 0; index < HRTIMER_MAX_CLOCK_BASES; index++) {
-               struct timerqueue_node *next;
-
                base = &cpu_base->clock_base[index];
-               next = timerqueue_getnext(&base->active);
-               if (!next)
+               if (!timerqueue_getnext(&base->active))
                        continue;
 
                if (gettime) {
@@ -1426,7 +1431,7 @@ void hrtimer_run_queues(void)
 
                raw_spin_lock(&cpu_base->lock);
 
-               while ((node = next)) {
+               while ((node = timerqueue_getnext(&base->active))) {
                        struct hrtimer *timer;
 
                        timer = container_of(node, struct hrtimer, node);
@@ -1740,7 +1745,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta,
        }
 
        /*
-        * A NULL parameter means "inifinte"
+        * A NULL parameter means "infinite"
         */
        if (!expires) {
                schedule();