diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-07-07 07:00:31 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-07-07 07:00:31 -0400 |
commit | a40f262cc21fbfd781bbddcc40b16b83a75f5f34 (patch) | |
tree | 1600f58173be05f561bcad045bca4014ab635d6f /kernel | |
parent | 951ed4d36b77ba9fe1ea08fc3c59d8bb6c9bda32 (diff) |
timekeeping: Move ktime_get() functions to timekeeping.c
The ktime_get() functions for GENERIC_TIME=n are still located in
hrtimer.c. Move them to time/timekeeping.c where they belong.
LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/hrtimer.c | 60 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 59 |
2 files changed, 57 insertions, 62 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 829e0664b72e..43d151f185b6 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -48,39 +48,6 @@ | |||
48 | 48 | ||
49 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
50 | 50 | ||
51 | #ifndef CONFIG_GENERIC_TIME | ||
52 | /** | ||
53 | * ktime_get - get the monotonic time in ktime_t format | ||
54 | * | ||
55 | * returns the time in ktime_t format | ||
56 | */ | ||
57 | ktime_t ktime_get(void) | ||
58 | { | ||
59 | struct timespec now; | ||
60 | |||
61 | ktime_get_ts(&now); | ||
62 | |||
63 | return timespec_to_ktime(now); | ||
64 | } | ||
65 | EXPORT_SYMBOL_GPL(ktime_get); | ||
66 | #endif | ||
67 | |||
68 | /** | ||
69 | * ktime_get_real - get the real (wall-) time in ktime_t format | ||
70 | * | ||
71 | * returns the time in ktime_t format | ||
72 | */ | ||
73 | ktime_t ktime_get_real(void) | ||
74 | { | ||
75 | struct timespec now; | ||
76 | |||
77 | getnstimeofday(&now); | ||
78 | |||
79 | return timespec_to_ktime(now); | ||
80 | } | ||
81 | |||
82 | EXPORT_SYMBOL_GPL(ktime_get_real); | ||
83 | |||
84 | /* | 51 | /* |
85 | * The timer bases: | 52 | * The timer bases: |
86 | * | 53 | * |
@@ -108,33 +75,6 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | |||
108 | } | 75 | } |
109 | }; | 76 | }; |
110 | 77 | ||
111 | #ifndef CONFIG_GENERIC_TIME | ||
112 | /** | ||
113 | * ktime_get_ts - get the monotonic clock in timespec format | ||
114 | * @ts: pointer to timespec variable | ||
115 | * | ||
116 | * The function calculates the monotonic clock from the realtime | ||
117 | * clock and the wall_to_monotonic offset and stores the result | ||
118 | * in normalized timespec format in the variable pointed to by @ts. | ||
119 | */ | ||
120 | void ktime_get_ts(struct timespec *ts) | ||
121 | { | ||
122 | struct timespec tomono; | ||
123 | unsigned long seq; | ||
124 | |||
125 | do { | ||
126 | seq = read_seqbegin(&xtime_lock); | ||
127 | getnstimeofday(ts); | ||
128 | tomono = wall_to_monotonic; | ||
129 | |||
130 | } while (read_seqretry(&xtime_lock, seq)); | ||
131 | |||
132 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, | ||
133 | ts->tv_nsec + tomono.tv_nsec); | ||
134 | } | ||
135 | EXPORT_SYMBOL_GPL(ktime_get_ts); | ||
136 | #endif | ||
137 | |||
138 | /* | 78 | /* |
139 | * Get the coarse grained time at the softirq based on xtime and | 79 | * Get the coarse grained time at the softirq based on xtime and |
140 | * wall_to_monotonic. | 80 | * wall_to_monotonic. |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 7a248135c6f2..02c0b2c9c674 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -290,10 +290,65 @@ static void change_clocksource(void) | |||
290 | clock->name); | 290 | clock->name); |
291 | */ | 291 | */ |
292 | } | 292 | } |
293 | #else | 293 | #else /* GENERIC_TIME */ |
294 | static inline void clocksource_forward_now(void) { } | 294 | static inline void clocksource_forward_now(void) { } |
295 | static inline void change_clocksource(void) { } | 295 | static inline void change_clocksource(void) { } |
296 | #endif | 296 | |
297 | /** | ||
298 | * ktime_get - get the monotonic time in ktime_t format | ||
299 | * | ||
300 | * returns the time in ktime_t format | ||
301 | */ | ||
302 | ktime_t ktime_get(void) | ||
303 | { | ||
304 | struct timespec now; | ||
305 | |||
306 | ktime_get_ts(&now); | ||
307 | |||
308 | return timespec_to_ktime(now); | ||
309 | } | ||
310 | EXPORT_SYMBOL_GPL(ktime_get); | ||
311 | |||
312 | /** | ||
313 | * ktime_get_ts - get the monotonic clock in timespec format | ||
314 | * @ts: pointer to timespec variable | ||
315 | * | ||
316 | * The function calculates the monotonic clock from the realtime | ||
317 | * clock and the wall_to_monotonic offset and stores the result | ||
318 | * in normalized timespec format in the variable pointed to by @ts. | ||
319 | */ | ||
320 | void ktime_get_ts(struct timespec *ts) | ||
321 | { | ||
322 | struct timespec tomono; | ||
323 | unsigned long seq; | ||
324 | |||
325 | do { | ||
326 | seq = read_seqbegin(&xtime_lock); | ||
327 | getnstimeofday(ts); | ||
328 | tomono = wall_to_monotonic; | ||
329 | |||
330 | } while (read_seqretry(&xtime_lock, seq)); | ||
331 | |||
332 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, | ||
333 | ts->tv_nsec + tomono.tv_nsec); | ||
334 | } | ||
335 | EXPORT_SYMBOL_GPL(ktime_get_ts); | ||
336 | #endif /* !GENERIC_TIME */ | ||
337 | |||
338 | /** | ||
339 | * ktime_get_real - get the real (wall-) time in ktime_t format | ||
340 | * | ||
341 | * returns the time in ktime_t format | ||
342 | */ | ||
343 | ktime_t ktime_get_real(void) | ||
344 | { | ||
345 | struct timespec now; | ||
346 | |||
347 | getnstimeofday(&now); | ||
348 | |||
349 | return timespec_to_ktime(now); | ||
350 | } | ||
351 | EXPORT_SYMBOL_GPL(ktime_get_real); | ||
297 | 352 | ||
298 | /** | 353 | /** |
299 | * getrawmonotonic - Returns the raw monotonic time in a timespec | 354 | * getrawmonotonic - Returns the raw monotonic time in a timespec |