diff options
-rw-r--r-- | include/linux/timex.h | 7 | ||||
-rw-r--r-- | kernel/time/ntp.c | 9 | ||||
-rw-r--r-- | kernel/time/ntp_internal.h | 11 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 21 |
4 files changed, 36 insertions, 12 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h index 5ec87c60b97c..b3726e61368e 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -125,9 +125,6 @@ | |||
125 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ | 125 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ |
126 | extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ | 126 | extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ |
127 | 127 | ||
128 | extern void ntp_init(void); | ||
129 | extern void ntp_clear(void); | ||
130 | |||
131 | /* Required to safely shift negative values */ | 128 | /* Required to safely shift negative values */ |
132 | #define shift_right(x, s) ({ \ | 129 | #define shift_right(x, s) ({ \ |
133 | __typeof__(x) __x = (x); \ | 130 | __typeof__(x) __x = (x); \ |
@@ -140,10 +137,6 @@ extern void ntp_clear(void); | |||
140 | #define NTP_INTERVAL_FREQ (HZ) | 137 | #define NTP_INTERVAL_FREQ (HZ) |
141 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 138 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
142 | 139 | ||
143 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | ||
144 | extern u64 ntp_tick_length(void); | ||
145 | |||
146 | extern int second_overflow(unsigned long secs); | ||
147 | extern int do_adjtimex(struct timex *); | 140 | extern int do_adjtimex(struct timex *); |
148 | extern void hardpps(const struct timespec *, const struct timespec *); | 141 | extern void hardpps(const struct timespec *, const struct timespec *); |
149 | 142 | ||
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 457d2ba245fe..8b107068d7e3 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/rtc.h> | 18 | #include <linux/rtc.h> |
19 | 19 | ||
20 | #include "tick-internal.h" | 20 | #include "tick-internal.h" |
21 | #include "ntp_internal.h" | ||
21 | 22 | ||
22 | /* | 23 | /* |
23 | * NTP timekeeping variables: | 24 | * NTP timekeeping variables: |
@@ -661,7 +662,7 @@ int ntp_validate_timex(struct timex *txc) | |||
661 | * adjtimex mainly allows reading (and writing, if superuser) of | 662 | * adjtimex mainly allows reading (and writing, if superuser) of |
662 | * kernel time-keeping variables. used by xntpd. | 663 | * kernel time-keeping variables. used by xntpd. |
663 | */ | 664 | */ |
664 | int do_adjtimex(struct timex *txc) | 665 | int __do_adjtimex(struct timex *txc) |
665 | { | 666 | { |
666 | struct timespec ts; | 667 | struct timespec ts; |
667 | u32 time_tai, orig_tai; | 668 | u32 time_tai, orig_tai; |
@@ -911,7 +912,7 @@ static void hardpps_update_phase(long error) | |||
911 | } | 912 | } |
912 | 913 | ||
913 | /* | 914 | /* |
914 | * hardpps() - discipline CPU clock oscillator to external PPS signal | 915 | * __hardpps() - discipline CPU clock oscillator to external PPS signal |
915 | * | 916 | * |
916 | * This routine is called at each PPS signal arrival in order to | 917 | * This routine is called at each PPS signal arrival in order to |
917 | * discipline the CPU clock oscillator to the PPS signal. It takes two | 918 | * discipline the CPU clock oscillator to the PPS signal. It takes two |
@@ -922,7 +923,7 @@ static void hardpps_update_phase(long error) | |||
922 | * This code is based on David Mills's reference nanokernel | 923 | * This code is based on David Mills's reference nanokernel |
923 | * implementation. It was mostly rewritten but keeps the same idea. | 924 | * implementation. It was mostly rewritten but keeps the same idea. |
924 | */ | 925 | */ |
925 | void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts) | 926 | void __hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts) |
926 | { | 927 | { |
927 | struct pps_normtime pts_norm, freq_norm; | 928 | struct pps_normtime pts_norm, freq_norm; |
928 | unsigned long flags; | 929 | unsigned long flags; |
@@ -976,8 +977,6 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts) | |||
976 | 977 | ||
977 | raw_spin_unlock_irqrestore(&ntp_lock, flags); | 978 | raw_spin_unlock_irqrestore(&ntp_lock, flags); |
978 | } | 979 | } |
979 | EXPORT_SYMBOL(hardpps); | ||
980 | |||
981 | #endif /* CONFIG_NTP_PPS */ | 980 | #endif /* CONFIG_NTP_PPS */ |
982 | 981 | ||
983 | static int __init ntp_tick_adj_setup(char *str) | 982 | static int __init ntp_tick_adj_setup(char *str) |
diff --git a/kernel/time/ntp_internal.h b/kernel/time/ntp_internal.h new file mode 100644 index 000000000000..fdee80cb34f3 --- /dev/null +++ b/kernel/time/ntp_internal.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _LINUX_NTP_INTERNAL_H | ||
2 | #define _LINUX_NTP_INTERNAL_H | ||
3 | |||
4 | extern void ntp_init(void); | ||
5 | extern void ntp_clear(void); | ||
6 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | ||
7 | extern u64 ntp_tick_length(void); | ||
8 | extern int second_overflow(unsigned long secs); | ||
9 | extern int __do_adjtimex(struct timex *); | ||
10 | extern void __hardpps(const struct timespec *, const struct timespec *); | ||
11 | #endif /* _LINUX_NTP_INTERNAL_H */ | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index c5feb7aa3acb..a138ec2cde3e 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pvclock_gtod.h> | 24 | #include <linux/pvclock_gtod.h> |
25 | 25 | ||
26 | #include "tick-internal.h" | 26 | #include "tick-internal.h" |
27 | #include "ntp_internal.h" | ||
27 | 28 | ||
28 | static struct timekeeper timekeeper; | 29 | static struct timekeeper timekeeper; |
29 | static DEFINE_RAW_SPINLOCK(timekeeper_lock); | 30 | static DEFINE_RAW_SPINLOCK(timekeeper_lock); |
@@ -1613,6 +1614,26 @@ ktime_t ktime_get_monotonic_offset(void) | |||
1613 | EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset); | 1614 | EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset); |
1614 | 1615 | ||
1615 | /** | 1616 | /** |
1617 | * do_adjtimex() - Accessor function to NTP __do_adjtimex function | ||
1618 | */ | ||
1619 | int do_adjtimex(struct timex *txc) | ||
1620 | { | ||
1621 | return __do_adjtimex(txc); | ||
1622 | } | ||
1623 | |||
1624 | |||
1625 | #ifdef CONFIG_NTP_PPS | ||
1626 | /** | ||
1627 | * hardpps() - Accessor function to NTP __hardpps function | ||
1628 | */ | ||
1629 | void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts) | ||
1630 | { | ||
1631 | __hardpps(phase_ts, raw_ts); | ||
1632 | } | ||
1633 | EXPORT_SYMBOL(hardpps); | ||
1634 | #endif | ||
1635 | |||
1636 | /** | ||
1616 | * xtime_update() - advances the timekeeping infrastructure | 1637 | * xtime_update() - advances the timekeeping infrastructure |
1617 | * @ticks: number of ticks, that have elapsed since the last call. | 1638 | * @ticks: number of ticks, that have elapsed since the last call. |
1618 | * | 1639 | * |