]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/time/tick-broadcast.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / kernel / time / tick-broadcast.c
index 8001d37071f59127dfac4ce83a651ad459395e66..db8e0f3d409b7da605c1ef83e69990e9d098aec4 100644 (file)
@@ -31,6 +31,12 @@ struct tick_device tick_broadcast_device;
 static cpumask_t tick_broadcast_mask;
 static DEFINE_SPINLOCK(tick_broadcast_lock);
 
+#ifdef CONFIG_TICK_ONESHOT
+static void tick_broadcast_clear_oneshot(int cpu);
+#else
+static inline void tick_broadcast_clear_oneshot(int cpu) { }
+#endif
+
 /*
  * Debugging: see timer_list.c
  */
@@ -49,7 +55,7 @@ cpumask_t *tick_get_broadcast_mask(void)
  */
 static void tick_broadcast_start_periodic(struct clock_event_device *bc)
 {
-       if (bc && bc->mode == CLOCK_EVT_MODE_SHUTDOWN)
+       if (bc)
                tick_setup_periodic(bc, 1);
 }
 
@@ -99,8 +105,19 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu)
                cpu_set(cpu, tick_broadcast_mask);
                tick_broadcast_start_periodic(tick_broadcast_device.evtdev);
                ret = 1;
-       }
+       } else {
+               /*
+                * When the new device is not affected by the stop
+                * feature and the cpu is marked in the broadcast mask
+                * then clear the broadcast bit.
+                */
+               if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) {
+                       int cpu = smp_processor_id();
 
+                       cpu_clear(cpu, tick_broadcast_mask);
+                       tick_broadcast_clear_oneshot(cpu);
+               }
+       }
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
        return ret;
 }
@@ -299,7 +316,7 @@ void tick_suspend_broadcast(void)
        spin_lock_irqsave(&tick_broadcast_lock, flags);
 
        bc = tick_broadcast_device.evtdev;
-       if (bc && tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
+       if (bc)
                clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
 
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
@@ -316,6 +333,8 @@ int tick_resume_broadcast(void)
        bc = tick_broadcast_device.evtdev;
 
        if (bc) {
+               clockevents_set_mode(bc, CLOCK_EVT_MODE_RESUME);
+
                switch (tick_broadcast_device.mode) {
                case TICKDEV_MODE_PERIODIC:
                        if(!cpus_empty(tick_broadcast_mask))
@@ -485,6 +504,16 @@ out:
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
 }
 
+/*
+ * Reset the one shot broadcast for a cpu
+ *
+ * Called with tick_broadcast_lock held
+ */
+static void tick_broadcast_clear_oneshot(int cpu)
+{
+       cpu_clear(cpu, tick_broadcast_oneshot_mask);
+}
+
 /**
  * tick_broadcast_setup_highres - setup the broadcast device for highres
  */