diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-01 17:04:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-01 17:04:50 -0400 |
commit | 5e359bf2219d8622eb0931701e45af55db323228 (patch) | |
tree | e47677ae0896c66a54c65b3221050eb0e9f23b81 /include | |
parent | 8d01b66b4f23a9fcf5c6787b27f0be5f8cbae98c (diff) | |
parent | 85e1cd6e769dfc84995270d0a4838021fcb8602d (diff) |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner:
"Rather large, but nothing exiting:
- new range check for settimeofday() to prevent that boot time
becomes negative.
- fix for file time rounding
- a few simplifications of the hrtimer code
- fix for the proc/timerlist code so the output of clock realtime
timers is accurate
- more y2038 work
- tree wide conversion of clockevent drivers to the new callbacks"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (88 commits)
hrtimer: Handle failure of tick_init_highres() gracefully
hrtimer: Unconfuse switch_hrtimer_base() a bit
hrtimer: Simplify get_target_base() by returning current base
hrtimer: Drop return code of hrtimer_switch_to_hres()
time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
time: Introduce current_kernel_time64()
time: Introduce struct itimerspec64
time: Add the common weak version of update_persistent_clock()
time: Always make sure wall_to_monotonic isn't positive
time: Fix nanosecond file time rounding in timespec_trunc()
timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers
cris/time: Migrate to new 'set-state' interface
kernel: broadcast-hrtimer: Migrate to new 'set-state' interface
xtensa/time: Migrate to new 'set-state' interface
unicore/time: Migrate to new 'set-state' interface
um/time: Migrate to new 'set-state' interface
sparc/time: Migrate to new 'set-state' interface
sh/localtimer: Migrate to new 'set-state' interface
score/time: Migrate to new 'set-state' interface
s390/time: Migrate to new 'set-state' interface
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/clockchips.h | 3 | ||||
-rw-r--r-- | include/linux/jiffies.h | 22 | ||||
-rw-r--r-- | include/linux/time64.h | 35 | ||||
-rw-r--r-- | include/linux/timekeeping.h | 9 |
4 files changed, 62 insertions, 7 deletions
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 597a1e836f22..31ce435981fe 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
@@ -234,13 +234,10 @@ static inline int tick_check_broadcast_expired(void) { return 0; } | |||
234 | static inline void tick_setup_hrtimer_broadcast(void) { } | 234 | static inline void tick_setup_hrtimer_broadcast(void) { } |
235 | # endif | 235 | # endif |
236 | 236 | ||
237 | extern int clockevents_notify(unsigned long reason, void *arg); | ||
238 | |||
239 | #else /* !CONFIG_GENERIC_CLOCKEVENTS: */ | 237 | #else /* !CONFIG_GENERIC_CLOCKEVENTS: */ |
240 | 238 | ||
241 | static inline void clockevents_suspend(void) { } | 239 | static inline void clockevents_suspend(void) { } |
242 | static inline void clockevents_resume(void) { } | 240 | static inline void clockevents_resume(void) { } |
243 | static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } | ||
244 | static inline int tick_check_broadcast_expired(void) { return 0; } | 241 | static inline int tick_check_broadcast_expired(void) { return 0; } |
245 | static inline void tick_setup_hrtimer_broadcast(void) { } | 242 | static inline void tick_setup_hrtimer_broadcast(void) { } |
246 | 243 | ||
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 9ea50da73513..5fdc55312334 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -409,9 +409,25 @@ static __always_inline unsigned long usecs_to_jiffies(const unsigned int u) | |||
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | extern unsigned long timespec_to_jiffies(const struct timespec *value); | 412 | extern unsigned long timespec64_to_jiffies(const struct timespec64 *value); |
413 | extern void jiffies_to_timespec(const unsigned long jiffies, | 413 | extern void jiffies_to_timespec64(const unsigned long jiffies, |
414 | struct timespec *value); | 414 | struct timespec64 *value); |
415 | static inline unsigned long timespec_to_jiffies(const struct timespec *value) | ||
416 | { | ||
417 | struct timespec64 ts = timespec_to_timespec64(*value); | ||
418 | |||
419 | return timespec64_to_jiffies(&ts); | ||
420 | } | ||
421 | |||
422 | static inline void jiffies_to_timespec(const unsigned long jiffies, | ||
423 | struct timespec *value) | ||
424 | { | ||
425 | struct timespec64 ts; | ||
426 | |||
427 | jiffies_to_timespec64(jiffies, &ts); | ||
428 | *value = timespec64_to_timespec(ts); | ||
429 | } | ||
430 | |||
415 | extern unsigned long timeval_to_jiffies(const struct timeval *value); | 431 | extern unsigned long timeval_to_jiffies(const struct timeval *value); |
416 | extern void jiffies_to_timeval(const unsigned long jiffies, | 432 | extern void jiffies_to_timeval(const unsigned long jiffies, |
417 | struct timeval *value); | 433 | struct timeval *value); |
diff --git a/include/linux/time64.h b/include/linux/time64.h index 77b5df2acd2a..367d5af899e8 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h | |||
@@ -12,11 +12,18 @@ typedef __s64 time64_t; | |||
12 | */ | 12 | */ |
13 | #if __BITS_PER_LONG == 64 | 13 | #if __BITS_PER_LONG == 64 |
14 | # define timespec64 timespec | 14 | # define timespec64 timespec |
15 | #define itimerspec64 itimerspec | ||
15 | #else | 16 | #else |
16 | struct timespec64 { | 17 | struct timespec64 { |
17 | time64_t tv_sec; /* seconds */ | 18 | time64_t tv_sec; /* seconds */ |
18 | long tv_nsec; /* nanoseconds */ | 19 | long tv_nsec; /* nanoseconds */ |
19 | }; | 20 | }; |
21 | |||
22 | struct itimerspec64 { | ||
23 | struct timespec64 it_interval; | ||
24 | struct timespec64 it_value; | ||
25 | }; | ||
26 | |||
20 | #endif | 27 | #endif |
21 | 28 | ||
22 | /* Parameters used to convert the timespec values: */ | 29 | /* Parameters used to convert the timespec values: */ |
@@ -45,6 +52,16 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) | |||
45 | return ts; | 52 | return ts; |
46 | } | 53 | } |
47 | 54 | ||
55 | static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) | ||
56 | { | ||
57 | return *its64; | ||
58 | } | ||
59 | |||
60 | static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) | ||
61 | { | ||
62 | return *its; | ||
63 | } | ||
64 | |||
48 | # define timespec64_equal timespec_equal | 65 | # define timespec64_equal timespec_equal |
49 | # define timespec64_compare timespec_compare | 66 | # define timespec64_compare timespec_compare |
50 | # define set_normalized_timespec64 set_normalized_timespec | 67 | # define set_normalized_timespec64 set_normalized_timespec |
@@ -77,6 +94,24 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) | |||
77 | return ret; | 94 | return ret; |
78 | } | 95 | } |
79 | 96 | ||
97 | static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) | ||
98 | { | ||
99 | struct itimerspec ret; | ||
100 | |||
101 | ret.it_interval = timespec64_to_timespec(its64->it_interval); | ||
102 | ret.it_value = timespec64_to_timespec(its64->it_value); | ||
103 | return ret; | ||
104 | } | ||
105 | |||
106 | static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) | ||
107 | { | ||
108 | struct itimerspec64 ret; | ||
109 | |||
110 | ret.it_interval = timespec_to_timespec64(its->it_interval); | ||
111 | ret.it_value = timespec_to_timespec64(its->it_value); | ||
112 | return ret; | ||
113 | } | ||
114 | |||
80 | static inline int timespec64_equal(const struct timespec64 *a, | 115 | static inline int timespec64_equal(const struct timespec64 *a, |
81 | const struct timespec64 *b) | 116 | const struct timespec64 *b) |
82 | { | 117 | { |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 6e191e4e6ab6..ba0ae09cbb21 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
@@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv, | |||
18 | * Kernel time accessors | 18 | * Kernel time accessors |
19 | */ | 19 | */ |
20 | unsigned long get_seconds(void); | 20 | unsigned long get_seconds(void); |
21 | struct timespec current_kernel_time(void); | 21 | struct timespec64 current_kernel_time64(void); |
22 | /* does not take xtime_lock */ | 22 | /* does not take xtime_lock */ |
23 | struct timespec __current_kernel_time(void); | 23 | struct timespec __current_kernel_time(void); |
24 | 24 | ||
25 | static inline struct timespec current_kernel_time(void) | ||
26 | { | ||
27 | struct timespec64 now = current_kernel_time64(); | ||
28 | |||
29 | return timespec64_to_timespec(now); | ||
30 | } | ||
31 | |||
25 | /* | 32 | /* |
26 | * timespec based interfaces | 33 | * timespec based interfaces |
27 | */ | 34 | */ |