diff options
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/clocksource.c | 14 | ||||
| -rw-r--r-- | kernel/time/ntp.c | 10 | ||||
| -rw-r--r-- | kernel/time/timekeeping.c | 3 |
3 files changed, 21 insertions, 6 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 13700833c181..1f663d23e85e 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; } | |||
| 453 | #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ | 453 | #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ |
| 454 | 454 | ||
| 455 | /** | 455 | /** |
| 456 | * clocksource_suspend - suspend the clocksource(s) | ||
| 457 | */ | ||
| 458 | void clocksource_suspend(void) | ||
| 459 | { | ||
| 460 | struct clocksource *cs; | ||
| 461 | |||
| 462 | list_for_each_entry_reverse(cs, &clocksource_list, list) | ||
| 463 | if (cs->suspend) | ||
| 464 | cs->suspend(cs); | ||
| 465 | } | ||
| 466 | |||
| 467 | /** | ||
| 456 | * clocksource_resume - resume the clocksource(s) | 468 | * clocksource_resume - resume the clocksource(s) |
| 457 | */ | 469 | */ |
| 458 | void clocksource_resume(void) | 470 | void clocksource_resume(void) |
| @@ -461,7 +473,7 @@ void clocksource_resume(void) | |||
| 461 | 473 | ||
| 462 | list_for_each_entry(cs, &clocksource_list, list) | 474 | list_for_each_entry(cs, &clocksource_list, list) |
| 463 | if (cs->resume) | 475 | if (cs->resume) |
| 464 | cs->resume(); | 476 | cs->resume(cs); |
| 465 | 477 | ||
| 466 | clocksource_resume_watchdog(); | 478 | clocksource_resume_watchdog(); |
| 467 | } | 479 | } |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 4800f933910e..7c0f180d6e9d 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
| @@ -58,10 +58,10 @@ static s64 time_offset; | |||
| 58 | static long time_constant = 2; | 58 | static long time_constant = 2; |
| 59 | 59 | ||
| 60 | /* maximum error (usecs): */ | 60 | /* maximum error (usecs): */ |
| 61 | long time_maxerror = NTP_PHASE_LIMIT; | 61 | static long time_maxerror = NTP_PHASE_LIMIT; |
| 62 | 62 | ||
| 63 | /* estimated error (usecs): */ | 63 | /* estimated error (usecs): */ |
| 64 | long time_esterror = NTP_PHASE_LIMIT; | 64 | static long time_esterror = NTP_PHASE_LIMIT; |
| 65 | 65 | ||
| 66 | /* frequency offset (scaled nsecs/secs): */ | 66 | /* frequency offset (scaled nsecs/secs): */ |
| 67 | static s64 time_freq; | 67 | static s64 time_freq; |
| @@ -142,11 +142,11 @@ static void ntp_update_offset(long offset) | |||
| 142 | * Select how the frequency is to be controlled | 142 | * Select how the frequency is to be controlled |
| 143 | * and in which mode (PLL or FLL). | 143 | * and in which mode (PLL or FLL). |
| 144 | */ | 144 | */ |
| 145 | secs = xtime.tv_sec - time_reftime; | 145 | secs = get_seconds() - time_reftime; |
| 146 | if (unlikely(time_status & STA_FREQHOLD)) | 146 | if (unlikely(time_status & STA_FREQHOLD)) |
| 147 | secs = 0; | 147 | secs = 0; |
| 148 | 148 | ||
| 149 | time_reftime = xtime.tv_sec; | 149 | time_reftime = get_seconds(); |
| 150 | 150 | ||
| 151 | offset64 = offset; | 151 | offset64 = offset; |
| 152 | freq_adj = (offset64 * secs) << | 152 | freq_adj = (offset64 * secs) << |
| @@ -368,7 +368,7 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts) | |||
| 368 | * reference time to current time. | 368 | * reference time to current time. |
| 369 | */ | 369 | */ |
| 370 | if (!(time_status & STA_PLL) && (txc->status & STA_PLL)) | 370 | if (!(time_status & STA_PLL) && (txc->status & STA_PLL)) |
| 371 | time_reftime = xtime.tv_sec; | 371 | time_reftime = get_seconds(); |
| 372 | 372 | ||
| 373 | /* only set allowed bits */ | 373 | /* only set allowed bits */ |
| 374 | time_status &= STA_RONLY; | 374 | time_status &= STA_RONLY; |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 7faaa32fbf4f..16736379a9ca 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) | |||
| 622 | write_sequnlock_irqrestore(&xtime_lock, flags); | 622 | write_sequnlock_irqrestore(&xtime_lock, flags); |
| 623 | 623 | ||
| 624 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); | 624 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); |
| 625 | clocksource_suspend(); | ||
| 625 | 626 | ||
| 626 | return 0; | 627 | return 0; |
| 627 | } | 628 | } |
| @@ -880,6 +881,7 @@ void getboottime(struct timespec *ts) | |||
| 880 | 881 | ||
| 881 | set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); | 882 | set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); |
| 882 | } | 883 | } |
| 884 | EXPORT_SYMBOL_GPL(getboottime); | ||
| 883 | 885 | ||
| 884 | /** | 886 | /** |
| 885 | * monotonic_to_bootbased - Convert the monotonic time to boot based. | 887 | * monotonic_to_bootbased - Convert the monotonic time to boot based. |
| @@ -889,6 +891,7 @@ void monotonic_to_bootbased(struct timespec *ts) | |||
| 889 | { | 891 | { |
| 890 | *ts = timespec_add_safe(*ts, total_sleep_time); | 892 | *ts = timespec_add_safe(*ts, total_sleep_time); |
| 891 | } | 893 | } |
| 894 | EXPORT_SYMBOL_GPL(monotonic_to_bootbased); | ||
| 892 | 895 | ||
| 893 | unsigned long get_seconds(void) | 896 | unsigned long get_seconds(void) |
| 894 | { | 897 | { |
