diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-02-21 17:51:37 -0500 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2013-03-22 19:20:00 -0400 |
commit | 7e40672d930b369c1984457233ec5557aa53bfb8 (patch) | |
tree | 7e87231ebdf0898f939e8b2b88ca48d1e4309eab /kernel | |
parent | eb93e4d93093615c60cb7dd3dcb24e46bd7d62d4 (diff) |
timekeeping: Move lock out of timekeeper struct
Make the lock a separate entity. Preparatory patch for shadow
timekeeper structure.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[Merged with CLOCK_TAI changes]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/timekeeping.c | 108 |
1 files changed, 53 insertions, 55 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b0c648fc959f..caede71c0a35 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "tick-internal.h" | 26 | #include "tick-internal.h" |
27 | 27 | ||
28 | static struct timekeeper timekeeper; | 28 | static struct timekeeper timekeeper; |
29 | static DEFINE_SEQLOCK(timekeeper_lock); | ||
29 | 30 | ||
30 | /* flag for if timekeeping is suspended */ | 31 | /* flag for if timekeeping is suspended */ |
31 | int __read_mostly timekeeping_suspended; | 32 | int __read_mostly timekeeping_suspended; |
@@ -212,11 +213,11 @@ int pvclock_gtod_register_notifier(struct notifier_block *nb) | |||
212 | unsigned long flags; | 213 | unsigned long flags; |
213 | int ret; | 214 | int ret; |
214 | 215 | ||
215 | write_seqlock_irqsave(&tk->lock, flags); | 216 | write_seqlock_irqsave(&timekeeper_lock, flags); |
216 | ret = raw_notifier_chain_register(&pvclock_gtod_chain, nb); | 217 | ret = raw_notifier_chain_register(&pvclock_gtod_chain, nb); |
217 | /* update timekeeping data */ | 218 | /* update timekeeping data */ |
218 | update_pvclock_gtod(tk); | 219 | update_pvclock_gtod(tk); |
219 | write_sequnlock_irqrestore(&tk->lock, flags); | 220 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
220 | 221 | ||
221 | return ret; | 222 | return ret; |
222 | } | 223 | } |
@@ -230,13 +231,12 @@ EXPORT_SYMBOL_GPL(pvclock_gtod_register_notifier); | |||
230 | */ | 231 | */ |
231 | int pvclock_gtod_unregister_notifier(struct notifier_block *nb) | 232 | int pvclock_gtod_unregister_notifier(struct notifier_block *nb) |
232 | { | 233 | { |
233 | struct timekeeper *tk = &timekeeper; | ||
234 | unsigned long flags; | 234 | unsigned long flags; |
235 | int ret; | 235 | int ret; |
236 | 236 | ||
237 | write_seqlock_irqsave(&tk->lock, flags); | 237 | write_seqlock_irqsave(&timekeeper_lock, flags); |
238 | ret = raw_notifier_chain_unregister(&pvclock_gtod_chain, nb); | 238 | ret = raw_notifier_chain_unregister(&pvclock_gtod_chain, nb); |
239 | write_sequnlock_irqrestore(&tk->lock, flags); | 239 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
240 | 240 | ||
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
@@ -296,12 +296,12 @@ int __getnstimeofday(struct timespec *ts) | |||
296 | s64 nsecs = 0; | 296 | s64 nsecs = 0; |
297 | 297 | ||
298 | do { | 298 | do { |
299 | seq = read_seqbegin(&tk->lock); | 299 | seq = read_seqbegin(&timekeeper_lock); |
300 | 300 | ||
301 | ts->tv_sec = tk->xtime_sec; | 301 | ts->tv_sec = tk->xtime_sec; |
302 | nsecs = timekeeping_get_ns(tk); | 302 | nsecs = timekeeping_get_ns(tk); |
303 | 303 | ||
304 | } while (read_seqretry(&tk->lock, seq)); | 304 | } while (read_seqretry(&timekeeper_lock, seq)); |
305 | 305 | ||
306 | ts->tv_nsec = 0; | 306 | ts->tv_nsec = 0; |
307 | timespec_add_ns(ts, nsecs); | 307 | timespec_add_ns(ts, nsecs); |
@@ -337,11 +337,11 @@ ktime_t ktime_get(void) | |||
337 | WARN_ON(timekeeping_suspended); | 337 | WARN_ON(timekeeping_suspended); |
338 | 338 | ||
339 | do { | 339 | do { |
340 | seq = read_seqbegin(&tk->lock); | 340 | seq = read_seqbegin(&timekeeper_lock); |
341 | secs = tk->xtime_sec + tk->wall_to_monotonic.tv_sec; | 341 | secs = tk->xtime_sec + tk->wall_to_monotonic.tv_sec; |
342 | nsecs = timekeeping_get_ns(tk) + tk->wall_to_monotonic.tv_nsec; | 342 | nsecs = timekeeping_get_ns(tk) + tk->wall_to_monotonic.tv_nsec; |
343 | 343 | ||
344 | } while (read_seqretry(&tk->lock, seq)); | 344 | } while (read_seqretry(&timekeeper_lock, seq)); |
345 | /* | 345 | /* |
346 | * Use ktime_set/ktime_add_ns to create a proper ktime on | 346 | * Use ktime_set/ktime_add_ns to create a proper ktime on |
347 | * 32-bit architectures without CONFIG_KTIME_SCALAR. | 347 | * 32-bit architectures without CONFIG_KTIME_SCALAR. |
@@ -368,12 +368,12 @@ void ktime_get_ts(struct timespec *ts) | |||
368 | WARN_ON(timekeeping_suspended); | 368 | WARN_ON(timekeeping_suspended); |
369 | 369 | ||
370 | do { | 370 | do { |
371 | seq = read_seqbegin(&tk->lock); | 371 | seq = read_seqbegin(&timekeeper_lock); |
372 | ts->tv_sec = tk->xtime_sec; | 372 | ts->tv_sec = tk->xtime_sec; |
373 | nsec = timekeeping_get_ns(tk); | 373 | nsec = timekeeping_get_ns(tk); |
374 | tomono = tk->wall_to_monotonic; | 374 | tomono = tk->wall_to_monotonic; |
375 | 375 | ||
376 | } while (read_seqretry(&tk->lock, seq)); | 376 | } while (read_seqretry(&timekeeper_lock, seq)); |
377 | 377 | ||
378 | ts->tv_sec += tomono.tv_sec; | 378 | ts->tv_sec += tomono.tv_sec; |
379 | ts->tv_nsec = 0; | 379 | ts->tv_nsec = 0; |
@@ -397,12 +397,12 @@ void timekeeping_clocktai(struct timespec *ts) | |||
397 | WARN_ON(timekeeping_suspended); | 397 | WARN_ON(timekeeping_suspended); |
398 | 398 | ||
399 | do { | 399 | do { |
400 | seq = read_seqbegin(&tk->lock); | 400 | seq = read_seqbegin(&timekeeper_lock); |
401 | 401 | ||
402 | ts->tv_sec = tk->xtime_sec + tk->tai_offset; | 402 | ts->tv_sec = tk->xtime_sec + tk->tai_offset; |
403 | nsecs = timekeeping_get_ns(tk); | 403 | nsecs = timekeeping_get_ns(tk); |
404 | 404 | ||
405 | } while (read_seqretry(&tk->lock, seq)); | 405 | } while (read_seqretry(&timekeeper_lock, seq)); |
406 | 406 | ||
407 | ts->tv_nsec = 0; | 407 | ts->tv_nsec = 0; |
408 | timespec_add_ns(ts, nsecs); | 408 | timespec_add_ns(ts, nsecs); |
@@ -445,7 +445,7 @@ void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real) | |||
445 | WARN_ON_ONCE(timekeeping_suspended); | 445 | WARN_ON_ONCE(timekeeping_suspended); |
446 | 446 | ||
447 | do { | 447 | do { |
448 | seq = read_seqbegin(&tk->lock); | 448 | seq = read_seqbegin(&timekeeper_lock); |
449 | 449 | ||
450 | *ts_raw = tk->raw_time; | 450 | *ts_raw = tk->raw_time; |
451 | ts_real->tv_sec = tk->xtime_sec; | 451 | ts_real->tv_sec = tk->xtime_sec; |
@@ -454,7 +454,7 @@ void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real) | |||
454 | nsecs_raw = timekeeping_get_ns_raw(tk); | 454 | nsecs_raw = timekeeping_get_ns_raw(tk); |
455 | nsecs_real = timekeeping_get_ns(tk); | 455 | nsecs_real = timekeeping_get_ns(tk); |
456 | 456 | ||
457 | } while (read_seqretry(&tk->lock, seq)); | 457 | } while (read_seqretry(&timekeeper_lock, seq)); |
458 | 458 | ||
459 | timespec_add_ns(ts_raw, nsecs_raw); | 459 | timespec_add_ns(ts_raw, nsecs_raw); |
460 | timespec_add_ns(ts_real, nsecs_real); | 460 | timespec_add_ns(ts_real, nsecs_real); |
@@ -494,7 +494,7 @@ int do_settimeofday(const struct timespec *tv) | |||
494 | if (!timespec_valid_strict(tv)) | 494 | if (!timespec_valid_strict(tv)) |
495 | return -EINVAL; | 495 | return -EINVAL; |
496 | 496 | ||
497 | write_seqlock_irqsave(&tk->lock, flags); | 497 | write_seqlock_irqsave(&timekeeper_lock, flags); |
498 | 498 | ||
499 | timekeeping_forward_now(tk); | 499 | timekeeping_forward_now(tk); |
500 | 500 | ||
@@ -508,7 +508,7 @@ int do_settimeofday(const struct timespec *tv) | |||
508 | 508 | ||
509 | timekeeping_update(tk, true); | 509 | timekeeping_update(tk, true); |
510 | 510 | ||
511 | write_sequnlock_irqrestore(&tk->lock, flags); | 511 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
512 | 512 | ||
513 | /* signal hrtimers about time change */ | 513 | /* signal hrtimers about time change */ |
514 | clock_was_set(); | 514 | clock_was_set(); |
@@ -533,7 +533,7 @@ int timekeeping_inject_offset(struct timespec *ts) | |||
533 | if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) | 533 | if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) |
534 | return -EINVAL; | 534 | return -EINVAL; |
535 | 535 | ||
536 | write_seqlock_irqsave(&tk->lock, flags); | 536 | write_seqlock_irqsave(&timekeeper_lock, flags); |
537 | 537 | ||
538 | timekeeping_forward_now(tk); | 538 | timekeeping_forward_now(tk); |
539 | 539 | ||
@@ -550,7 +550,7 @@ int timekeeping_inject_offset(struct timespec *ts) | |||
550 | error: /* even if we error out, we forwarded the time, so call update */ | 550 | error: /* even if we error out, we forwarded the time, so call update */ |
551 | timekeeping_update(tk, true); | 551 | timekeeping_update(tk, true); |
552 | 552 | ||
553 | write_sequnlock_irqrestore(&tk->lock, flags); | 553 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
554 | 554 | ||
555 | /* signal hrtimers about time change */ | 555 | /* signal hrtimers about time change */ |
556 | clock_was_set(); | 556 | clock_was_set(); |
@@ -571,9 +571,9 @@ s32 timekeeping_get_tai_offset(void) | |||
571 | s32 ret; | 571 | s32 ret; |
572 | 572 | ||
573 | do { | 573 | do { |
574 | seq = read_seqbegin(&tk->lock); | 574 | seq = read_seqbegin(&timekeeper_lock); |
575 | ret = tk->tai_offset; | 575 | ret = tk->tai_offset; |
576 | } while (read_seqretry(&tk->lock, seq)); | 576 | } while (read_seqretry(&timekeeper_lock, seq)); |
577 | 577 | ||
578 | return ret; | 578 | return ret; |
579 | } | 579 | } |
@@ -597,9 +597,9 @@ void timekeeping_set_tai_offset(s32 tai_offset) | |||
597 | struct timekeeper *tk = &timekeeper; | 597 | struct timekeeper *tk = &timekeeper; |
598 | unsigned long flags; | 598 | unsigned long flags; |
599 | 599 | ||
600 | write_seqlock_irqsave(&tk->lock, flags); | 600 | write_seqlock_irqsave(&timekeeper_lock, flags); |
601 | __timekeeping_set_tai_offset(tk, tai_offset); | 601 | __timekeeping_set_tai_offset(tk, tai_offset); |
602 | write_sequnlock_irqrestore(&tk->lock, flags); | 602 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
603 | } | 603 | } |
604 | 604 | ||
605 | /** | 605 | /** |
@@ -615,7 +615,7 @@ static int change_clocksource(void *data) | |||
615 | 615 | ||
616 | new = (struct clocksource *) data; | 616 | new = (struct clocksource *) data; |
617 | 617 | ||
618 | write_seqlock_irqsave(&tk->lock, flags); | 618 | write_seqlock_irqsave(&timekeeper_lock, flags); |
619 | 619 | ||
620 | timekeeping_forward_now(tk); | 620 | timekeeping_forward_now(tk); |
621 | if (!new->enable || new->enable(new) == 0) { | 621 | if (!new->enable || new->enable(new) == 0) { |
@@ -626,7 +626,7 @@ static int change_clocksource(void *data) | |||
626 | } | 626 | } |
627 | timekeeping_update(tk, true); | 627 | timekeeping_update(tk, true); |
628 | 628 | ||
629 | write_sequnlock_irqrestore(&tk->lock, flags); | 629 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
630 | 630 | ||
631 | return 0; | 631 | return 0; |
632 | } | 632 | } |
@@ -676,11 +676,11 @@ void getrawmonotonic(struct timespec *ts) | |||
676 | s64 nsecs; | 676 | s64 nsecs; |
677 | 677 | ||
678 | do { | 678 | do { |
679 | seq = read_seqbegin(&tk->lock); | 679 | seq = read_seqbegin(&timekeeper_lock); |
680 | nsecs = timekeeping_get_ns_raw(tk); | 680 | nsecs = timekeeping_get_ns_raw(tk); |
681 | *ts = tk->raw_time; | 681 | *ts = tk->raw_time; |
682 | 682 | ||
683 | } while (read_seqretry(&tk->lock, seq)); | 683 | } while (read_seqretry(&timekeeper_lock, seq)); |
684 | 684 | ||
685 | timespec_add_ns(ts, nsecs); | 685 | timespec_add_ns(ts, nsecs); |
686 | } | 686 | } |
@@ -696,11 +696,11 @@ int timekeeping_valid_for_hres(void) | |||
696 | int ret; | 696 | int ret; |
697 | 697 | ||
698 | do { | 698 | do { |
699 | seq = read_seqbegin(&tk->lock); | 699 | seq = read_seqbegin(&timekeeper_lock); |
700 | 700 | ||
701 | ret = tk->clock->flags & CLOCK_SOURCE_VALID_FOR_HRES; | 701 | ret = tk->clock->flags & CLOCK_SOURCE_VALID_FOR_HRES; |
702 | 702 | ||
703 | } while (read_seqretry(&tk->lock, seq)); | 703 | } while (read_seqretry(&timekeeper_lock, seq)); |
704 | 704 | ||
705 | return ret; | 705 | return ret; |
706 | } | 706 | } |
@@ -715,11 +715,11 @@ u64 timekeeping_max_deferment(void) | |||
715 | u64 ret; | 715 | u64 ret; |
716 | 716 | ||
717 | do { | 717 | do { |
718 | seq = read_seqbegin(&tk->lock); | 718 | seq = read_seqbegin(&timekeeper_lock); |
719 | 719 | ||
720 | ret = tk->clock->max_idle_ns; | 720 | ret = tk->clock->max_idle_ns; |
721 | 721 | ||
722 | } while (read_seqretry(&tk->lock, seq)); | 722 | } while (read_seqretry(&timekeeper_lock, seq)); |
723 | 723 | ||
724 | return ret; | 724 | return ret; |
725 | } | 725 | } |
@@ -782,11 +782,9 @@ void __init timekeeping_init(void) | |||
782 | boot.tv_nsec = 0; | 782 | boot.tv_nsec = 0; |
783 | } | 783 | } |
784 | 784 | ||
785 | seqlock_init(&tk->lock); | ||
786 | |||
787 | ntp_init(); | 785 | ntp_init(); |
788 | 786 | ||
789 | write_seqlock_irqsave(&tk->lock, flags); | 787 | write_seqlock_irqsave(&timekeeper_lock, flags); |
790 | clock = clocksource_default_clock(); | 788 | clock = clocksource_default_clock(); |
791 | if (clock->enable) | 789 | if (clock->enable) |
792 | clock->enable(clock); | 790 | clock->enable(clock); |
@@ -805,7 +803,7 @@ void __init timekeeping_init(void) | |||
805 | tmp.tv_nsec = 0; | 803 | tmp.tv_nsec = 0; |
806 | tk_set_sleep_time(tk, tmp); | 804 | tk_set_sleep_time(tk, tmp); |
807 | 805 | ||
808 | write_sequnlock_irqrestore(&tk->lock, flags); | 806 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
809 | } | 807 | } |
810 | 808 | ||
811 | /* time in seconds when suspend began */ | 809 | /* time in seconds when suspend began */ |
@@ -853,7 +851,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta) | |||
853 | if (has_persistent_clock()) | 851 | if (has_persistent_clock()) |
854 | return; | 852 | return; |
855 | 853 | ||
856 | write_seqlock_irqsave(&tk->lock, flags); | 854 | write_seqlock_irqsave(&timekeeper_lock, flags); |
857 | 855 | ||
858 | timekeeping_forward_now(tk); | 856 | timekeeping_forward_now(tk); |
859 | 857 | ||
@@ -861,7 +859,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta) | |||
861 | 859 | ||
862 | timekeeping_update(tk, true); | 860 | timekeeping_update(tk, true); |
863 | 861 | ||
864 | write_sequnlock_irqrestore(&tk->lock, flags); | 862 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
865 | 863 | ||
866 | /* signal hrtimers about time change */ | 864 | /* signal hrtimers about time change */ |
867 | clock_was_set(); | 865 | clock_was_set(); |
@@ -888,7 +886,7 @@ static void timekeeping_resume(void) | |||
888 | clockevents_resume(); | 886 | clockevents_resume(); |
889 | clocksource_resume(); | 887 | clocksource_resume(); |
890 | 888 | ||
891 | write_seqlock_irqsave(&tk->lock, flags); | 889 | write_seqlock_irqsave(&timekeeper_lock, flags); |
892 | 890 | ||
893 | /* | 891 | /* |
894 | * After system resumes, we need to calculate the suspended time and | 892 | * After system resumes, we need to calculate the suspended time and |
@@ -940,7 +938,7 @@ static void timekeeping_resume(void) | |||
940 | tk->ntp_error = 0; | 938 | tk->ntp_error = 0; |
941 | timekeeping_suspended = 0; | 939 | timekeeping_suspended = 0; |
942 | timekeeping_update(tk, false); | 940 | timekeeping_update(tk, false); |
943 | write_sequnlock_irqrestore(&tk->lock, flags); | 941 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
944 | 942 | ||
945 | touch_softlockup_watchdog(); | 943 | touch_softlockup_watchdog(); |
946 | 944 | ||
@@ -959,7 +957,7 @@ static int timekeeping_suspend(void) | |||
959 | 957 | ||
960 | read_persistent_clock(&timekeeping_suspend_time); | 958 | read_persistent_clock(&timekeeping_suspend_time); |
961 | 959 | ||
962 | write_seqlock_irqsave(&tk->lock, flags); | 960 | write_seqlock_irqsave(&timekeeper_lock, flags); |
963 | timekeeping_forward_now(tk); | 961 | timekeeping_forward_now(tk); |
964 | timekeeping_suspended = 1; | 962 | timekeeping_suspended = 1; |
965 | 963 | ||
@@ -982,7 +980,7 @@ static int timekeeping_suspend(void) | |||
982 | timekeeping_suspend_time = | 980 | timekeeping_suspend_time = |
983 | timespec_add(timekeeping_suspend_time, delta_delta); | 981 | timespec_add(timekeeping_suspend_time, delta_delta); |
984 | } | 982 | } |
985 | write_sequnlock_irqrestore(&tk->lock, flags); | 983 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
986 | 984 | ||
987 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); | 985 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); |
988 | clocksource_suspend(); | 986 | clocksource_suspend(); |
@@ -1322,7 +1320,7 @@ static void update_wall_time(void) | |||
1322 | int shift = 0, maxshift; | 1320 | int shift = 0, maxshift; |
1323 | unsigned long flags; | 1321 | unsigned long flags; |
1324 | 1322 | ||
1325 | write_seqlock_irqsave(&tk->lock, flags); | 1323 | write_seqlock_irqsave(&timekeeper_lock, flags); |
1326 | 1324 | ||
1327 | /* Make sure we're fully resumed: */ | 1325 | /* Make sure we're fully resumed: */ |
1328 | if (unlikely(timekeeping_suspended)) | 1326 | if (unlikely(timekeeping_suspended)) |
@@ -1377,7 +1375,7 @@ static void update_wall_time(void) | |||
1377 | timekeeping_update(tk, false); | 1375 | timekeeping_update(tk, false); |
1378 | 1376 | ||
1379 | out: | 1377 | out: |
1380 | write_sequnlock_irqrestore(&tk->lock, flags); | 1378 | write_sequnlock_irqrestore(&timekeeper_lock, flags); |
1381 | 1379 | ||
1382 | } | 1380 | } |
1383 | 1381 | ||
@@ -1425,13 +1423,13 @@ void get_monotonic_boottime(struct timespec *ts) | |||
1425 | WARN_ON(timekeeping_suspended); | 1423 | WARN_ON(timekeeping_suspended); |
1426 | 1424 | ||
1427 | do { | 1425 | do { |
1428 | seq = read_seqbegin(&tk->lock); | 1426 | seq = read_seqbegin(&timekeeper_lock); |
1429 | ts->tv_sec = tk->xtime_sec; | 1427 | ts->tv_sec = tk->xtime_sec; |
1430 | nsec = timekeeping_get_ns(tk); | 1428 | nsec = timekeeping_get_ns(tk); |
1431 | tomono = tk->wall_to_monotonic; | 1429 | tomono = tk->wall_to_monotonic; |
1432 | sleep = tk->total_sleep_time; | 1430 | sleep = tk->total_sleep_time; |
1433 | 1431 | ||
1434 | } while (read_seqretry(&tk->lock, seq)); | 1432 | } while (read_seqretry(&timekeeper_lock, seq)); |
1435 | 1433 | ||
1436 | ts->tv_sec += tomono.tv_sec + sleep.tv_sec; | 1434 | ts->tv_sec += tomono.tv_sec + sleep.tv_sec; |
1437 | ts->tv_nsec = 0; | 1435 | ts->tv_nsec = 0; |
@@ -1490,10 +1488,10 @@ struct timespec current_kernel_time(void) | |||
1490 | unsigned long seq; | 1488 | unsigned long seq; |
1491 | 1489 | ||
1492 | do { | 1490 | do { |
1493 | seq = read_seqbegin(&tk->lock); | 1491 | seq = read_seqbegin(&timekeeper_lock); |
1494 | 1492 | ||
1495 | now = tk_xtime(tk); | 1493 | now = tk_xtime(tk); |
1496 | } while (read_seqretry(&tk->lock, seq)); | 1494 | } while (read_seqretry(&timekeeper_lock, seq)); |
1497 | 1495 | ||
1498 | return now; | 1496 | return now; |
1499 | } | 1497 | } |
@@ -1506,11 +1504,11 @@ struct timespec get_monotonic_coarse(void) | |||
1506 | unsigned long seq; | 1504 | unsigned long seq; |
1507 | 1505 | ||
1508 | do { | 1506 | do { |
1509 | seq = read_seqbegin(&tk->lock); | 1507 | seq = read_seqbegin(&timekeeper_lock); |
1510 | 1508 | ||
1511 | now = tk_xtime(tk); | 1509 | now = tk_xtime(tk); |
1512 | mono = tk->wall_to_monotonic; | 1510 | mono = tk->wall_to_monotonic; |
1513 | } while (read_seqretry(&tk->lock, seq)); | 1511 | } while (read_seqretry(&timekeeper_lock, seq)); |
1514 | 1512 | ||
1515 | set_normalized_timespec(&now, now.tv_sec + mono.tv_sec, | 1513 | set_normalized_timespec(&now, now.tv_sec + mono.tv_sec, |
1516 | now.tv_nsec + mono.tv_nsec); | 1514 | now.tv_nsec + mono.tv_nsec); |
@@ -1541,11 +1539,11 @@ void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, | |||
1541 | unsigned long seq; | 1539 | unsigned long seq; |
1542 | 1540 | ||
1543 | do { | 1541 | do { |
1544 | seq = read_seqbegin(&tk->lock); | 1542 | seq = read_seqbegin(&timekeeper_lock); |
1545 | *xtim = tk_xtime(tk); | 1543 | *xtim = tk_xtime(tk); |
1546 | *wtom = tk->wall_to_monotonic; | 1544 | *wtom = tk->wall_to_monotonic; |
1547 | *sleep = tk->total_sleep_time; | 1545 | *sleep = tk->total_sleep_time; |
1548 | } while (read_seqretry(&tk->lock, seq)); | 1546 | } while (read_seqretry(&timekeeper_lock, seq)); |
1549 | } | 1547 | } |
1550 | 1548 | ||
1551 | #ifdef CONFIG_HIGH_RES_TIMERS | 1549 | #ifdef CONFIG_HIGH_RES_TIMERS |
@@ -1566,7 +1564,7 @@ ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot, | |||
1566 | u64 secs, nsecs; | 1564 | u64 secs, nsecs; |
1567 | 1565 | ||
1568 | do { | 1566 | do { |
1569 | seq = read_seqbegin(&tk->lock); | 1567 | seq = read_seqbegin(&timekeeper_lock); |
1570 | 1568 | ||
1571 | secs = tk->xtime_sec; | 1569 | secs = tk->xtime_sec; |
1572 | nsecs = timekeeping_get_ns(tk); | 1570 | nsecs = timekeeping_get_ns(tk); |
@@ -1574,7 +1572,7 @@ ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot, | |||
1574 | *offs_real = tk->offs_real; | 1572 | *offs_real = tk->offs_real; |
1575 | *offs_boot = tk->offs_boot; | 1573 | *offs_boot = tk->offs_boot; |
1576 | *offs_tai = tk->offs_tai; | 1574 | *offs_tai = tk->offs_tai; |
1577 | } while (read_seqretry(&tk->lock, seq)); | 1575 | } while (read_seqretry(&timekeeper_lock, seq)); |
1578 | 1576 | ||
1579 | now = ktime_add_ns(ktime_set(secs, 0), nsecs); | 1577 | now = ktime_add_ns(ktime_set(secs, 0), nsecs); |
1580 | now = ktime_sub(now, *offs_real); | 1578 | now = ktime_sub(now, *offs_real); |
@@ -1592,9 +1590,9 @@ ktime_t ktime_get_monotonic_offset(void) | |||
1592 | struct timespec wtom; | 1590 | struct timespec wtom; |
1593 | 1591 | ||
1594 | do { | 1592 | do { |
1595 | seq = read_seqbegin(&tk->lock); | 1593 | seq = read_seqbegin(&timekeeper_lock); |
1596 | wtom = tk->wall_to_monotonic; | 1594 | wtom = tk->wall_to_monotonic; |
1597 | } while (read_seqretry(&tk->lock, seq)); | 1595 | } while (read_seqretry(&timekeeper_lock, seq)); |
1598 | 1596 | ||
1599 | return timespec_to_ktime(wtom); | 1597 | return timespec_to_ktime(wtom); |
1600 | } | 1598 | } |