[PATCH] tick-management: core functionality
[pandora-kernel.git] / kernel / hrtimer.c
index fee18b2..a2310d1 100644 (file)
@@ -46,7 +46,7 @@
  *
  * returns the time in ktime_t format
  */
-static ktime_t ktime_get(void)
+ktime_t ktime_get(void)
 {
        struct timespec now;
 
@@ -60,7 +60,7 @@ static ktime_t ktime_get(void)
  *
  * returns the time in ktime_t format
  */
-static ktime_t ktime_get_real(void)
+ktime_t ktime_get_real(void)
 {
        struct timespec now;
 
@@ -172,8 +172,6 @@ static inline int hrtimer_callback_running(struct hrtimer *timer)
  */
 #ifdef CONFIG_SMP
 
-#define set_curr_timer(b, t)           do { (b)->curr_timer = (t); } while (0)
-
 /*
  * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock
  * means that all timers which are tied to this base via timer->base are
@@ -227,7 +225,7 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base)
                 * completed. There is no conflict as we hold the lock until
                 * the timer is enqueued.
                 */
-               if (unlikely(base->cpu_base->curr_timer == timer))
+               if (unlikely(timer->state & HRTIMER_STATE_CALLBACK))
                        return base;
 
                /* See the comment in lock_timer_base() */
@@ -241,8 +239,6 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base)
 
 #else /* CONFIG_SMP */
 
-#define set_curr_timer(b, t)           do { } while (0)
-
 static inline struct hrtimer_clock_base *
 lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
 {
@@ -314,14 +310,6 @@ static unsigned long ktime_divns(const ktime_t kt, s64 div)
 # define ktime_divns(kt, div)          (unsigned long)((kt).tv64 / (div))
 #endif /* BITS_PER_LONG >= 64 */
 
-/*
- * Timekeeping resumed notification
- */
-void hrtimer_notify_resume(void)
-{
-       clock_was_set();
-}
-
 /*
  * Counterpart to lock_timer_base above:
  */
@@ -670,7 +658,6 @@ static inline void run_hrtimer_queue(struct hrtimer_cpu_base *cpu_base,
                        break;
 
                fn = timer->function;
-               set_curr_timer(cpu_base, timer);
                __remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK);
                spin_unlock_irq(&cpu_base->lock);
 
@@ -684,7 +671,6 @@ static inline void run_hrtimer_queue(struct hrtimer_cpu_base *cpu_base,
                        enqueue_hrtimer(timer, base);
                }
        }
-       set_curr_timer(cpu_base, NULL);
        spin_unlock_irq(&cpu_base->lock);
 }
 
@@ -871,8 +857,6 @@ static void migrate_hrtimers(int cpu)
        spin_lock(&old_base->lock);
 
        for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
-               BUG_ON(old_base->curr_timer);
-
                migrate_hrtimer_list(&old_base->clock_base[i],
                                     &new_base->clock_base[i]);
        }
@@ -897,6 +881,7 @@ static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,
 
 #ifdef CONFIG_HOTPLUG_CPU
        case CPU_DEAD:
+               clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DEAD, &cpu);
                migrate_hrtimers(cpu);
                break;
 #endif