diff options
author | John Stultz <john.stultz@linaro.org> | 2014-07-16 17:03:53 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 13:16:50 -0400 |
commit | 24e4a8c3e8868874835b0f1ad6dd417341e99822 (patch) | |
tree | d71c666cc53db7e0d906e838f23ff67855b86b6b /kernel/time/hrtimer.c | |
parent | 76f4108892d9a9e3408bba839914f97a54086a6f (diff) |
ktime: Kill non-scalar ktime_t implementation for 2038
The non-scalar ktime_t implementation is basically a timespec
which has to be changed to support dates past 2038 on 32bit
systems.
This patch removes the non-scalar ktime_t implementation, forcing
the scalar s64 nanosecond version on all architectures.
This may have additional performance overhead on some 32bit
systems when converting between ktime_t and timespec structures,
however the majority of 32bit systems (arm and i386) were already
using scalar ktime_t, so no performance regressions will be seen
on those platforms.
On affected platforms, I'm open to finding optimizations, including
avoiding converting to timespecs where possible.
[ tglx: We can now cleanup the ktime_t.tv64 mess, but thats a
different issue and we can throw a coccinelle script at it ]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time/hrtimer.c')
-rw-r--r-- | kernel/time/hrtimer.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 2f4ef8a1e5ff..19f211051c35 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -261,60 +261,6 @@ lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) | |||
261 | * too large for inlining: | 261 | * too large for inlining: |
262 | */ | 262 | */ |
263 | #if BITS_PER_LONG < 64 | 263 | #if BITS_PER_LONG < 64 |
264 | # ifndef CONFIG_KTIME_SCALAR | ||
265 | /** | ||
266 | * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable | ||
267 | * @kt: addend | ||
268 | * @nsec: the scalar nsec value to add | ||
269 | * | ||
270 | * Returns the sum of kt and nsec in ktime_t format | ||
271 | */ | ||
272 | ktime_t ktime_add_ns(const ktime_t kt, u64 nsec) | ||
273 | { | ||
274 | ktime_t tmp; | ||
275 | |||
276 | if (likely(nsec < NSEC_PER_SEC)) { | ||
277 | tmp.tv64 = nsec; | ||
278 | } else { | ||
279 | unsigned long rem = do_div(nsec, NSEC_PER_SEC); | ||
280 | |||
281 | /* Make sure nsec fits into long */ | ||
282 | if (unlikely(nsec > KTIME_SEC_MAX)) | ||
283 | return (ktime_t){ .tv64 = KTIME_MAX }; | ||
284 | |||
285 | tmp = ktime_set((long)nsec, rem); | ||
286 | } | ||
287 | |||
288 | return ktime_add(kt, tmp); | ||
289 | } | ||
290 | |||
291 | EXPORT_SYMBOL_GPL(ktime_add_ns); | ||
292 | |||
293 | /** | ||
294 | * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable | ||
295 | * @kt: minuend | ||
296 | * @nsec: the scalar nsec value to subtract | ||
297 | * | ||
298 | * Returns the subtraction of @nsec from @kt in ktime_t format | ||
299 | */ | ||
300 | ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec) | ||
301 | { | ||
302 | ktime_t tmp; | ||
303 | |||
304 | if (likely(nsec < NSEC_PER_SEC)) { | ||
305 | tmp.tv64 = nsec; | ||
306 | } else { | ||
307 | unsigned long rem = do_div(nsec, NSEC_PER_SEC); | ||
308 | |||
309 | tmp = ktime_set((long)nsec, rem); | ||
310 | } | ||
311 | |||
312 | return ktime_sub(kt, tmp); | ||
313 | } | ||
314 | |||
315 | EXPORT_SYMBOL_GPL(ktime_sub_ns); | ||
316 | # endif /* !CONFIG_KTIME_SCALAR */ | ||
317 | |||
318 | /* | 264 | /* |
319 | * Divide a ktime value by a nanosecond value | 265 | * Divide a ktime value by a nanosecond value |
320 | */ | 266 | */ |