Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Commit

Permalink
time: Move common updates to a function
Browse files Browse the repository at this point in the history
This is a backport of cc06268

While not a bugfix itself, it allows following fixes to backport
in a more straightforward manner.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
KAGA-KOKO authored and gregkh committed Jul 19, 2012
1 parent c33f242 commit c7e2580
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,19 @@ static struct timespec total_sleep_time;
*/
static struct timespec raw_time;

/* must hold write on xtime_lock */
static void timekeeping_update(bool clearntp)
{
if (clearntp) {
timekeeper.ntp_error = 0;
ntp_clear();
}
update_vsyscall(&xtime, &wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
}



/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;

Expand Down Expand Up @@ -366,11 +379,7 @@ int do_settimeofday(const struct timespec *tv)

xtime = *tv;

timekeeper.ntp_error = 0;
ntp_clear();

update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
timekeeper.mult);
timekeeping_update(true);

write_sequnlock_irqrestore(&xtime_lock, flags);

Expand Down Expand Up @@ -403,11 +412,7 @@ int timekeeping_inject_offset(struct timespec *ts)
xtime = timespec_add(xtime, *ts);
wall_to_monotonic = timespec_sub(wall_to_monotonic, *ts);

timekeeper.ntp_error = 0;
ntp_clear();

update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
timekeeper.mult);
timekeeping_update(true);

write_sequnlock_irqrestore(&xtime_lock, flags);

Expand Down Expand Up @@ -630,10 +635,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta)

__timekeeping_inject_sleeptime(delta);

timekeeper.ntp_error = 0;
ntp_clear();
update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
timekeeper.mult);
timekeeping_update(true);

write_sequnlock_irqrestore(&xtime_lock, flags);

Expand Down Expand Up @@ -938,9 +940,7 @@ static void update_wall_time(void)
wall_to_monotonic.tv_sec -= leap;
}

/* check to see if there is a new clocksource to use */
update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
timekeeper.mult);
timekeeping_update(false);
}

/**
Expand Down

0 comments on commit c7e2580

Please sign in to comment.