aboutsummaryrefslogtreecommitdiff
path: root/kernel/time
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/clocksource.c14
-rw-r--r--kernel/time/ntp.c10
-rw-r--r--kernel/time/timekeeping.c1
3 files changed, 19 insertions, 6 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 13700833c18..1f663d23e85 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -453,6 +453,18 @@ static inline int clocksource_watchdog_kthread(void *data) { return 0; }
#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
/**
+ * clocksource_suspend - suspend the clocksource(s)
+ */
+void clocksource_suspend(void)
+{
+ struct clocksource *cs;
+
+ list_for_each_entry_reverse(cs, &clocksource_list, list)
+ if (cs->suspend)
+ cs->suspend(cs);
+}
+
+/**
* clocksource_resume - resume the clocksource(s)
*/
void clocksource_resume(void)
@@ -461,7 +473,7 @@ void clocksource_resume(void)
list_for_each_entry(cs, &clocksource_list, list)
if (cs->resume)
- cs->resume();
+ cs->resume(cs);
clocksource_resume_watchdog();
}
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 4800f933910..7c0f180d6e9 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -58,10 +58,10 @@ static s64 time_offset;
static long time_constant = 2;
/* maximum error (usecs): */
-long time_maxerror = NTP_PHASE_LIMIT;
+static long time_maxerror = NTP_PHASE_LIMIT;
/* estimated error (usecs): */
-long time_esterror = NTP_PHASE_LIMIT;
+static long time_esterror = NTP_PHASE_LIMIT;
/* frequency offset (scaled nsecs/secs): */
static s64 time_freq;
@@ -142,11 +142,11 @@ static void ntp_update_offset(long offset)
* Select how the frequency is to be controlled
* and in which mode (PLL or FLL).
*/
- secs = xtime.tv_sec - time_reftime;
+ secs = get_seconds() - time_reftime;
if (unlikely(time_status & STA_FREQHOLD))
secs = 0;
- time_reftime = xtime.tv_sec;
+ time_reftime = get_seconds();
offset64 = offset;
freq_adj = (offset64 * secs) <<
@@ -368,7 +368,7 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts)
* reference time to current time.
*/
if (!(time_status & STA_PLL) && (txc->status & STA_PLL))
- time_reftime = xtime.tv_sec;
+ time_reftime = get_seconds();
/* only set allowed bits */
time_status &= STA_RONLY;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e2ab064c6d4..16736379a9c 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -622,6 +622,7 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
write_sequnlock_irqrestore(&xtime_lock, flags);
clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
+ clocksource_suspend();
return 0;
}