diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 16:18:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 16:18:29 -0400 |
commit | b62ad9ab181a67207a4c8c373461b587c4861a68 (patch) | |
tree | ace1572964d81f5f9bbc10b7960c1f742832d744 /include/linux | |
parent | af390084359a5de20046c901529b2b6a50b941cb (diff) | |
parent | b29230769e3482bbd62a07d6d9485371ee66a18f (diff) |
Merge branch 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
um: Fix read_persistent_clock fallout
kgdb: Do not access xtime directly
powerpc: Clean up obsolete code relating to decrementer and timebase
powerpc: Rework VDSO gettimeofday to prevent time going backwards
clocksource: Add __clocksource_updatefreq_hz/khz methods
x86: Convert common clocksources to use clocksource_register_hz/khz
timekeeping: Make xtime and wall_to_monotonic static
hrtimer: Cleanup direct access to wall_to_monotonic
um: Convert to use read_persistent_clock
timkeeping: Fix update_vsyscall to provide wall_to_monotonic offset
powerpc: Cleanup xtime usage
powerpc: Simplify update_vsyscall
time: Kill off CONFIG_GENERIC_TIME
time: Implement timespec_add
x86: Fix vtime/file timestamp inconsistencies
Trivial conflicts in Documentation/feature-removal-schedule.txt
Much less trivial conflicts in arch/powerpc/kernel/time.c resolved as
per Thomas' earlier merge commit 47916be4e28c ("Merge branch
'powerpc.cherry-picks' into timers/clocksource")
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/clocksource.h | 17 | ||||
-rw-r--r-- | include/linux/time.h | 21 |
2 files changed, 33 insertions, 5 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 5ea3c60c160c..c37b21ad5a3b 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -292,6 +292,8 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); | |||
292 | */ | 292 | */ |
293 | extern int | 293 | extern int |
294 | __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq); | 294 | __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq); |
295 | extern void | ||
296 | __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq); | ||
295 | 297 | ||
296 | static inline int clocksource_register_hz(struct clocksource *cs, u32 hz) | 298 | static inline int clocksource_register_hz(struct clocksource *cs, u32 hz) |
297 | { | 299 | { |
@@ -303,6 +305,15 @@ static inline int clocksource_register_khz(struct clocksource *cs, u32 khz) | |||
303 | return __clocksource_register_scale(cs, 1000, khz); | 305 | return __clocksource_register_scale(cs, 1000, khz); |
304 | } | 306 | } |
305 | 307 | ||
308 | static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz) | ||
309 | { | ||
310 | __clocksource_updatefreq_scale(cs, 1, hz); | ||
311 | } | ||
312 | |||
313 | static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz) | ||
314 | { | ||
315 | __clocksource_updatefreq_scale(cs, 1000, khz); | ||
316 | } | ||
306 | 317 | ||
307 | static inline void | 318 | static inline void |
308 | clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) | 319 | clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) |
@@ -313,11 +324,13 @@ clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) | |||
313 | 324 | ||
314 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL | 325 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL |
315 | extern void | 326 | extern void |
316 | update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); | 327 | update_vsyscall(struct timespec *ts, struct timespec *wtm, |
328 | struct clocksource *c, u32 mult); | ||
317 | extern void update_vsyscall_tz(void); | 329 | extern void update_vsyscall_tz(void); |
318 | #else | 330 | #else |
319 | static inline void | 331 | static inline void |
320 | update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) | 332 | update_vsyscall(struct timespec *ts, struct timespec *wtm, |
333 | struct clocksource *c, u32 mult) | ||
321 | { | 334 | { |
322 | } | 335 | } |
323 | 336 | ||
diff --git a/include/linux/time.h b/include/linux/time.h index ea3559f0b3f2..cb34e35fabac 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -76,9 +76,25 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon, | |||
76 | const unsigned int min, const unsigned int sec); | 76 | const unsigned int min, const unsigned int sec); |
77 | 77 | ||
78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); | 78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); |
79 | |||
80 | /* | ||
81 | * timespec_add_safe assumes both values are positive and checks | ||
82 | * for overflow. It will return TIME_T_MAX if the reutrn would be | ||
83 | * smaller then either of the arguments. | ||
84 | */ | ||
79 | extern struct timespec timespec_add_safe(const struct timespec lhs, | 85 | extern struct timespec timespec_add_safe(const struct timespec lhs, |
80 | const struct timespec rhs); | 86 | const struct timespec rhs); |
81 | 87 | ||
88 | |||
89 | static inline struct timespec timespec_add(struct timespec lhs, | ||
90 | struct timespec rhs) | ||
91 | { | ||
92 | struct timespec ts_delta; | ||
93 | set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec, | ||
94 | lhs.tv_nsec + rhs.tv_nsec); | ||
95 | return ts_delta; | ||
96 | } | ||
97 | |||
82 | /* | 98 | /* |
83 | * sub = lhs - rhs, in normalized form | 99 | * sub = lhs - rhs, in normalized form |
84 | */ | 100 | */ |
@@ -97,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs, | |||
97 | #define timespec_valid(ts) \ | 113 | #define timespec_valid(ts) \ |
98 | (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) | 114 | (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) |
99 | 115 | ||
100 | extern struct timespec xtime; | ||
101 | extern struct timespec wall_to_monotonic; | ||
102 | extern seqlock_t xtime_lock; | 116 | extern seqlock_t xtime_lock; |
103 | 117 | ||
104 | extern void read_persistent_clock(struct timespec *ts); | 118 | extern void read_persistent_clock(struct timespec *ts); |
@@ -110,7 +124,8 @@ extern int timekeeping_suspended; | |||
110 | 124 | ||
111 | unsigned long get_seconds(void); | 125 | unsigned long get_seconds(void); |
112 | struct timespec current_kernel_time(void); | 126 | struct timespec current_kernel_time(void); |
113 | struct timespec __current_kernel_time(void); /* does not hold xtime_lock */ | 127 | struct timespec __current_kernel_time(void); /* does not take xtime_lock */ |
128 | struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */ | ||
114 | struct timespec get_monotonic_coarse(void); | 129 | struct timespec get_monotonic_coarse(void); |
115 | 130 | ||
116 | #define CURRENT_TIME (current_kernel_time()) | 131 | #define CURRENT_TIME (current_kernel_time()) |