Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-microblaze.git] / kernel / time / tick-common.c
index 6c9c342..a03764d 100644 (file)
  */
 DEFINE_PER_CPU(struct tick_device, tick_cpu_device);
 /*
- * Tick next event: keeps track of the tick time
+ * Tick next event: keeps track of the tick time. It's updated by the
+ * CPU which handles the tick and protected by jiffies_lock. There is
+ * no requirement to write hold the jiffies seqcount for it.
  */
 ktime_t tick_next_period;
-ktime_t tick_period;
 
 /*
  * tick_do_timer_cpu is a timer core internal variable which holds the CPU NR
@@ -88,7 +89,7 @@ static void tick_periodic(int cpu)
                write_seqcount_begin(&jiffies_seq);
 
                /* Keep track of the next tick event */
-               tick_next_period = ktime_add(tick_next_period, tick_period);
+               tick_next_period = ktime_add_ns(tick_next_period, TICK_NSEC);
 
                do_timer(1);
                write_seqcount_end(&jiffies_seq);
@@ -127,7 +128,7 @@ void tick_handle_periodic(struct clock_event_device *dev)
                 * Setup the next period for devices, which do not have
                 * periodic mode:
                 */
-               next = ktime_add(next, tick_period);
+               next = ktime_add_ns(next, TICK_NSEC);
 
                if (!clockevents_program_event(dev, next, false))
                        return;
@@ -173,7 +174,7 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
                for (;;) {
                        if (!clockevents_program_event(dev, next, false))
                                return;
-                       next = ktime_add(next, tick_period);
+                       next = ktime_add_ns(next, TICK_NSEC);
                }
        }
 }
@@ -220,7 +221,6 @@ static void tick_setup_device(struct tick_device *td,
                        tick_do_timer_cpu = cpu;
 
                        tick_next_period = ktime_get();
-                       tick_period = NSEC_PER_SEC / HZ;
 #ifdef CONFIG_NO_HZ_FULL
                        /*
                         * The boot CPU may be nohz_full, in which case set