lkml.org 
[lkml]   [2011]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 5/7] timekeeping: Move common updates to a function
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/time/timekeeping.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)

Index: linux-2.6-tip/kernel/time/timekeeping.c
===================================================================
--- linux-2.6-tip.orig/kernel/time/timekeeping.c
+++ linux-2.6-tip/kernel/time/timekeeping.c
@@ -170,14 +170,23 @@ static struct timespec raw_time;
/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;

+static void timekeeping_update(bool clearntp)
+{
+ if (clearntp) {
+ timekeeper.ntp_error = 0;
+ ntp_clear();
+ }
+ update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
+ timekeeper.mult);
+}
+
/* must hold xtime_lock */
void timekeeping_leap_insert(int leapsecond)
{
write_seqcount_begin(&xtime_seq);
xtime.tv_sec += leapsecond;
wall_to_monotonic.tv_sec -= leapsecond;
- update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
- timekeeper.mult);
+ timekeeping_update(false);
write_seqcount_end(&xtime_seq);
}

@@ -375,12 +384,7 @@ int do_settimeofday(const struct timespe

xtime = *tv;

- timekeeper.ntp_error = 0;
- ntp_clear();
-
- update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
- timekeeper.mult);
-
+ timekeeping_update(true);
write_seqcount_end(&xtime_seq);
raw_spin_unlock_irqrestore(&xtime_lock, flags);

@@ -414,12 +418,7 @@ int timekeeping_inject_offset(struct tim
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_seqcount_end(&xtime_seq);
raw_spin_unlock_irqrestore(&xtime_lock, flags);

@@ -651,11 +650,7 @@ void timekeeping_inject_sleeptime(struct

__timekeeping_inject_sleeptime(delta);

- timekeeper.ntp_error = 0;
- ntp_clear();
- update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
- timekeeper.mult);
-
+ timekeeping_update(true);
write_seqcount_end(&xtime_seq);
raw_spin_unlock_irqrestore(&xtime_lock, flags);




\
 
 \ /
  Last update: 2011-11-14 00:23    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog