Skip to content

Commit

Permalink
tick: Remove code duplication in tick_handle_periodic()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Viresh Kumar authored and Thomas Gleixner committed Mar 25, 2014
1 parent cacb3c7 commit b97f029
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions kernel/time/tick-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,19 @@ static void tick_periodic(int cpu)
void tick_handle_periodic(struct clock_event_device *dev)
{
int cpu = smp_processor_id();
ktime_t next;
ktime_t next = dev->next_event;

tick_periodic(cpu);

if (dev->mode != CLOCK_EVT_MODE_ONESHOT)
return;
/*
* Setup the next period for devices, which do not have
* periodic mode:
*/
next = ktime_add(dev->next_event, tick_period);
for (;;) {
/*
* Setup the next period for devices, which do not have
* periodic mode:
*/
next = ktime_add(next, tick_period);

if (!clockevents_program_event(dev, next, false))
return;
/*
Expand All @@ -123,7 +124,6 @@ void tick_handle_periodic(struct clock_event_device *dev)
*/
if (timekeeping_valid_for_hres())
tick_periodic(cpu);
next = ktime_add(next, tick_period);
}
}

Expand Down

0 comments on commit b97f029

Please sign in to comment.