clocksource: Cleanup clocksource selection
[linux-2.6.git] / kernel / time / tick-oneshot.c
index 2e35501..a96c0e2 100644 (file)
@@ -43,19 +43,17 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
                 * and emit a warning.
                 */
                if (++i > 2) {
-                       printk(KERN_WARNING "CE: __tick_program_event of %s is "
-                              "stuck %llx %llx\n", dev->name ? dev->name : "?",
-                              now.tv64, expires.tv64);
-                       printk(KERN_WARNING
-                              "CE: increasing min_delta_ns %ld to %ld nsec\n",
-                              dev->min_delta_ns, dev->min_delta_ns << 1);
-                       WARN_ON(1);
-
-                       /* Double the min. delta and try again */
+                       /* Increase the min. delta and try again */
                        if (!dev->min_delta_ns)
                                dev->min_delta_ns = 5000;
                        else
-                               dev->min_delta_ns <<= 1;
+                               dev->min_delta_ns += dev->min_delta_ns >> 1;
+
+                       printk(KERN_WARNING
+                              "CE: %s increasing min_delta_ns to %lu nsec\n",
+                              dev->name ? dev->name : "?",
+                              dev->min_delta_ns << 1);
+
                        i = 0;
                }
 
@@ -130,6 +128,23 @@ int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *))
        return 0;
 }
 
+/**
+ * tick_check_oneshot_mode - check whether the system is in oneshot mode
+ *
+ * returns 1 when either nohz or highres are enabled. otherwise 0.
+ */
+int tick_oneshot_mode_active(void)
+{
+       unsigned long flags;
+       int ret;
+
+       local_irq_save(flags);
+       ret = __get_cpu_var(tick_cpu_device).mode == TICKDEV_MODE_ONESHOT;
+       local_irq_restore(flags);
+
+       return ret;
+}
+
 #ifdef CONFIG_HIGH_RES_TIMERS
 /**
  * tick_init_highres - switch to high resolution mode