aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-03-25 04:26:23 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-03-25 19:56:49 -0400
commitb97f0291a2504291aef850077f98cab68a5a2f33 (patch)
tree0afd803e1ceee86ef5a44d1a43028d624dd2110d /kernel/time
parentcacb3c76c2012ade52124e8c6fdc5cb125625772 (diff)
tick: Remove code duplication in tick_handle_periodic()
tick_handle_periodic() is calling ktime_add() at two places, first before the infinite loop and then at the end of infinite loop. We can rearrange code a bit to fix code duplication here. It looks quite simple and shouldn't break anything, I guess :) Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: linaro-kernel@lists.linaro.org Cc: fweisbec@gmail.com Link: http://lkml.kernel.org/r/be3481e8f3f71df694a4b43623254fc93ca51b59.1395735873.git.viresh.kumar@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/tick-common.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 0fec63414fb6..015661279b68 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -98,18 +98,19 @@ static void tick_periodic(int cpu)
98void tick_handle_periodic(struct clock_event_device *dev) 98void tick_handle_periodic(struct clock_event_device *dev)
99{ 99{
100 int cpu = smp_processor_id(); 100 int cpu = smp_processor_id();
101 ktime_t next; 101 ktime_t next = dev->next_event;
102 102
103 tick_periodic(cpu); 103 tick_periodic(cpu);
104 104
105 if (dev->mode != CLOCK_EVT_MODE_ONESHOT) 105 if (dev->mode != CLOCK_EVT_MODE_ONESHOT)
106 return; 106 return;
107 /*
108 * Setup the next period for devices, which do not have
109 * periodic mode:
110 */
111 next = ktime_add(dev->next_event, tick_period);
112 for (;;) { 107 for (;;) {
108 /*
109 * Setup the next period for devices, which do not have
110 * periodic mode:
111 */
112 next = ktime_add(next, tick_period);
113
113 if (!clockevents_program_event(dev, next, false)) 114 if (!clockevents_program_event(dev, next, false))
114 return; 115 return;
115 /* 116 /*
@@ -123,7 +124,6 @@ void tick_handle_periodic(struct clock_event_device *dev)
123 */ 124 */
124 if (timekeeping_valid_for_hres()) 125 if (timekeeping_valid_for_hres())
125 tick_periodic(cpu); 126 tick_periodic(cpu);
126 next = ktime_add(next, tick_period);
127 } 127 }
128} 128}
129 129