diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/time.c | 16 | ||||
| -rw-r--r-- | kernel/time/Kconfig | 4 | ||||
| -rw-r--r-- | kernel/time/clocksource.c | 4 | ||||
| -rw-r--r-- | kernel/time/timekeeping.c | 55 | ||||
| -rw-r--r-- | kernel/trace/Kconfig | 4 |
5 files changed, 10 insertions, 73 deletions
diff --git a/kernel/time.c b/kernel/time.c index 848b1c2ab09a..ba9b338d1835 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
| @@ -300,22 +300,6 @@ struct timespec timespec_trunc(struct timespec t, unsigned gran) | |||
| 300 | } | 300 | } |
| 301 | EXPORT_SYMBOL(timespec_trunc); | 301 | EXPORT_SYMBOL(timespec_trunc); |
| 302 | 302 | ||
| 303 | #ifndef CONFIG_GENERIC_TIME | ||
| 304 | /* | ||
| 305 | * Simulate gettimeofday using do_gettimeofday which only allows a timeval | ||
| 306 | * and therefore only yields usec accuracy | ||
| 307 | */ | ||
| 308 | void getnstimeofday(struct timespec *tv) | ||
| 309 | { | ||
| 310 | struct timeval x; | ||
| 311 | |||
| 312 | do_gettimeofday(&x); | ||
| 313 | tv->tv_sec = x.tv_sec; | ||
| 314 | tv->tv_nsec = x.tv_usec * NSEC_PER_USEC; | ||
| 315 | } | ||
| 316 | EXPORT_SYMBOL_GPL(getnstimeofday); | ||
| 317 | #endif | ||
| 318 | |||
| 319 | /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. | 303 | /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. |
| 320 | * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 | 304 | * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 |
| 321 | * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. | 305 | * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. |
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index 95ed42951e0a..f06a8a365648 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig | |||
| @@ -6,7 +6,7 @@ config TICK_ONESHOT | |||
| 6 | 6 | ||
| 7 | config NO_HZ | 7 | config NO_HZ |
| 8 | bool "Tickless System (Dynamic Ticks)" | 8 | bool "Tickless System (Dynamic Ticks)" |
| 9 | depends on GENERIC_TIME && GENERIC_CLOCKEVENTS | 9 | depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS |
| 10 | select TICK_ONESHOT | 10 | select TICK_ONESHOT |
| 11 | help | 11 | help |
| 12 | This option enables a tickless system: timer interrupts will | 12 | This option enables a tickless system: timer interrupts will |
| @@ -15,7 +15,7 @@ config NO_HZ | |||
| 15 | 15 | ||
| 16 | config HIGH_RES_TIMERS | 16 | config HIGH_RES_TIMERS |
| 17 | bool "High Resolution Timer Support" | 17 | bool "High Resolution Timer Support" |
| 18 | depends on GENERIC_TIME && GENERIC_CLOCKEVENTS | 18 | depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS |
| 19 | select TICK_ONESHOT | 19 | select TICK_ONESHOT |
| 20 | help | 20 | help |
| 21 | This option enables high resolution timer support. If your | 21 | This option enables high resolution timer support. If your |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index f08e99c1d561..c543d21b4e54 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -531,7 +531,7 @@ static u64 clocksource_max_deferment(struct clocksource *cs) | |||
| 531 | return max_nsecs - (max_nsecs >> 5); | 531 | return max_nsecs - (max_nsecs >> 5); |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | #ifdef CONFIG_GENERIC_TIME | 534 | #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET |
| 535 | 535 | ||
| 536 | /** | 536 | /** |
| 537 | * clocksource_select - Select the best clocksource available | 537 | * clocksource_select - Select the best clocksource available |
| @@ -577,7 +577,7 @@ static void clocksource_select(void) | |||
| 577 | } | 577 | } |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | #else /* CONFIG_GENERIC_TIME */ | 580 | #else /* !CONFIG_ARCH_USES_GETTIMEOFFSET */ |
| 581 | 581 | ||
| 582 | static inline void clocksource_select(void) { } | 582 | static inline void clocksource_select(void) { } |
| 583 | 583 | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 623fe3d504dc..73edd4074b50 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -173,8 +173,6 @@ void timekeeping_leap_insert(int leapsecond) | |||
| 173 | update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); | 173 | update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | #ifdef CONFIG_GENERIC_TIME | ||
| 177 | |||
| 178 | /** | 176 | /** |
| 179 | * timekeeping_forward_now - update clock to the current time | 177 | * timekeeping_forward_now - update clock to the current time |
| 180 | * | 178 | * |
| @@ -376,52 +374,6 @@ void timekeeping_notify(struct clocksource *clock) | |||
| 376 | tick_clock_notify(); | 374 | tick_clock_notify(); |
| 377 | } | 375 | } |
| 378 | 376 | ||
| 379 | #else /* GENERIC_TIME */ | ||
| 380 | |||
| 381 | static inline void timekeeping_forward_now(void) { } | ||
| 382 | |||
| 383 | /** | ||
| 384 | * ktime_get - get the monotonic time in ktime_t format | ||
| 385 | * | ||
| 386 | * returns the time in ktime_t format | ||
| 387 | */ | ||
| 388 | ktime_t ktime_get(void) | ||
| 389 | { | ||
| 390 | struct timespec now; | ||
| 391 | |||
| 392 | ktime_get_ts(&now); | ||
| 393 | |||
| 394 | return timespec_to_ktime(now); | ||
| 395 | } | ||
| 396 | EXPORT_SYMBOL_GPL(ktime_get); | ||
| 397 | |||
| 398 | /** | ||
| 399 | * ktime_get_ts - get the monotonic clock in timespec format | ||
| 400 | * @ts: pointer to timespec variable | ||
| 401 | * | ||
| 402 | * The function calculates the monotonic clock from the realtime | ||
| 403 | * clock and the wall_to_monotonic offset and stores the result | ||
| 404 | * in normalized timespec format in the variable pointed to by @ts. | ||
| 405 | */ | ||
| 406 | void ktime_get_ts(struct timespec *ts) | ||
| 407 | { | ||
| 408 | struct timespec tomono; | ||
| 409 | unsigned long seq; | ||
| 410 | |||
| 411 | do { | ||
| 412 | seq = read_seqbegin(&xtime_lock); | ||
| 413 | getnstimeofday(ts); | ||
| 414 | tomono = wall_to_monotonic; | ||
| 415 | |||
| 416 | } while (read_seqretry(&xtime_lock, seq)); | ||
| 417 | |||
| 418 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, | ||
| 419 | ts->tv_nsec + tomono.tv_nsec); | ||
| 420 | } | ||
| 421 | EXPORT_SYMBOL_GPL(ktime_get_ts); | ||
| 422 | |||
| 423 | #endif /* !GENERIC_TIME */ | ||
| 424 | |||
| 425 | /** | 377 | /** |
| 426 | * ktime_get_real - get the real (wall-) time in ktime_t format | 378 | * ktime_get_real - get the real (wall-) time in ktime_t format |
| 427 | * | 379 | * |
| @@ -784,10 +736,11 @@ void update_wall_time(void) | |||
| 784 | return; | 736 | return; |
| 785 | 737 | ||
| 786 | clock = timekeeper.clock; | 738 | clock = timekeeper.clock; |
| 787 | #ifdef CONFIG_GENERIC_TIME | 739 | |
| 788 | offset = (clock->read(clock) - clock->cycle_last) & clock->mask; | 740 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET |
| 789 | #else | ||
| 790 | offset = timekeeper.cycle_interval; | 741 | offset = timekeeper.cycle_interval; |
| 742 | #else | ||
| 743 | offset = (clock->read(clock) - clock->cycle_last) & clock->mask; | ||
| 791 | #endif | 744 | #endif |
| 792 | timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift; | 745 | timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift; |
| 793 | 746 | ||
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 8b1797c4545b..7531ddaf3afe 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
| @@ -153,7 +153,7 @@ config IRQSOFF_TRACER | |||
| 153 | bool "Interrupts-off Latency Tracer" | 153 | bool "Interrupts-off Latency Tracer" |
| 154 | default n | 154 | default n |
| 155 | depends on TRACE_IRQFLAGS_SUPPORT | 155 | depends on TRACE_IRQFLAGS_SUPPORT |
| 156 | depends on GENERIC_TIME | 156 | depends on !ARCH_USES_GETTIMEOFFSET |
| 157 | select TRACE_IRQFLAGS | 157 | select TRACE_IRQFLAGS |
| 158 | select GENERIC_TRACER | 158 | select GENERIC_TRACER |
| 159 | select TRACER_MAX_TRACE | 159 | select TRACER_MAX_TRACE |
| @@ -175,7 +175,7 @@ config IRQSOFF_TRACER | |||
| 175 | config PREEMPT_TRACER | 175 | config PREEMPT_TRACER |
| 176 | bool "Preemption-off Latency Tracer" | 176 | bool "Preemption-off Latency Tracer" |
| 177 | default n | 177 | default n |
| 178 | depends on GENERIC_TIME | 178 | depends on !ARCH_USES_GETTIMEOFFSET |
| 179 | depends on PREEMPT | 179 | depends on PREEMPT |
| 180 | select GENERIC_TRACER | 180 | select GENERIC_TRACER |
| 181 | select TRACER_MAX_TRACE | 181 | select TRACER_MAX_TRACE |
