diff options
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/pcic.c | 16 | ||||
-rw-r--r-- | arch/sparc/kernel/time.c | 18 |
2 files changed, 5 insertions, 29 deletions
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index e19b1bad9bc5..edb6cc665f56 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
@@ -765,8 +765,6 @@ static __inline__ unsigned long do_gettimeoffset(void) | |||
765 | return count; | 765 | return count; |
766 | } | 766 | } |
767 | 767 | ||
768 | extern unsigned long wall_jiffies; | ||
769 | |||
770 | static void pci_do_gettimeofday(struct timeval *tv) | 768 | static void pci_do_gettimeofday(struct timeval *tv) |
771 | { | 769 | { |
772 | unsigned long flags; | 770 | unsigned long flags; |
@@ -775,26 +773,17 @@ static void pci_do_gettimeofday(struct timeval *tv) | |||
775 | unsigned long max_ntp_tick = tick_usec - tickadj; | 773 | unsigned long max_ntp_tick = tick_usec - tickadj; |
776 | 774 | ||
777 | do { | 775 | do { |
778 | unsigned long lost; | ||
779 | |||
780 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 776 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
781 | usec = do_gettimeoffset(); | 777 | usec = do_gettimeoffset(); |
782 | lost = jiffies - wall_jiffies; | ||
783 | 778 | ||
784 | /* | 779 | /* |
785 | * If time_adjust is negative then NTP is slowing the clock | 780 | * If time_adjust is negative then NTP is slowing the clock |
786 | * so make sure not to go into next possible interval. | 781 | * so make sure not to go into next possible interval. |
787 | * Better to lose some accuracy than have time go backwards.. | 782 | * Better to lose some accuracy than have time go backwards.. |
788 | */ | 783 | */ |
789 | if (unlikely(time_adjust < 0)) { | 784 | if (unlikely(time_adjust < 0)) |
790 | usec = min(usec, max_ntp_tick); | 785 | usec = min(usec, max_ntp_tick); |
791 | 786 | ||
792 | if (lost) | ||
793 | usec += lost * max_ntp_tick; | ||
794 | } | ||
795 | else if (unlikely(lost)) | ||
796 | usec += lost * tick_usec; | ||
797 | |||
798 | sec = xtime.tv_sec; | 787 | sec = xtime.tv_sec; |
799 | usec += (xtime.tv_nsec / 1000); | 788 | usec += (xtime.tv_nsec / 1000); |
800 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 789 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
@@ -819,8 +808,7 @@ static int pci_do_settimeofday(struct timespec *tv) | |||
819 | * wall time. Discover what correction gettimeofday() would have | 808 | * wall time. Discover what correction gettimeofday() would have |
820 | * made, and then undo it! | 809 | * made, and then undo it! |
821 | */ | 810 | */ |
822 | tv->tv_nsec -= 1000 * (do_gettimeoffset() + | 811 | tv->tv_nsec -= 1000 * do_gettimeoffset(); |
823 | (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ)); | ||
824 | while (tv->tv_nsec < 0) { | 812 | while (tv->tv_nsec < 0) { |
825 | tv->tv_nsec += NSEC_PER_SEC; | 813 | tv->tv_nsec += NSEC_PER_SEC; |
826 | tv->tv_sec--; | 814 | tv->tv_sec--; |
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 6f84fa1b58e5..e10dc831944d 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c | |||
@@ -43,8 +43,6 @@ | |||
43 | #include <asm/pcic.h> | 43 | #include <asm/pcic.h> |
44 | #include <asm/of_device.h> | 44 | #include <asm/of_device.h> |
45 | 45 | ||
46 | extern unsigned long wall_jiffies; | ||
47 | |||
48 | DEFINE_SPINLOCK(rtc_lock); | 46 | DEFINE_SPINLOCK(rtc_lock); |
49 | enum sparc_clock_type sp_clock_typ; | 47 | enum sparc_clock_type sp_clock_typ; |
50 | DEFINE_SPINLOCK(mostek_lock); | 48 | DEFINE_SPINLOCK(mostek_lock); |
@@ -449,7 +447,7 @@ unsigned long long sched_clock(void) | |||
449 | 447 | ||
450 | /* Ok, my cute asm atomicity trick doesn't work anymore. | 448 | /* Ok, my cute asm atomicity trick doesn't work anymore. |
451 | * There are just too many variables that need to be protected | 449 | * There are just too many variables that need to be protected |
452 | * now (both members of xtime, wall_jiffies, et al.) | 450 | * now (both members of xtime, et al.) |
453 | */ | 451 | */ |
454 | void do_gettimeofday(struct timeval *tv) | 452 | void do_gettimeofday(struct timeval *tv) |
455 | { | 453 | { |
@@ -459,26 +457,17 @@ void do_gettimeofday(struct timeval *tv) | |||
459 | unsigned long max_ntp_tick = tick_usec - tickadj; | 457 | unsigned long max_ntp_tick = tick_usec - tickadj; |
460 | 458 | ||
461 | do { | 459 | do { |
462 | unsigned long lost; | ||
463 | |||
464 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 460 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
465 | usec = do_gettimeoffset(); | 461 | usec = do_gettimeoffset(); |
466 | lost = jiffies - wall_jiffies; | ||
467 | 462 | ||
468 | /* | 463 | /* |
469 | * If time_adjust is negative then NTP is slowing the clock | 464 | * If time_adjust is negative then NTP is slowing the clock |
470 | * so make sure not to go into next possible interval. | 465 | * so make sure not to go into next possible interval. |
471 | * Better to lose some accuracy than have time go backwards.. | 466 | * Better to lose some accuracy than have time go backwards.. |
472 | */ | 467 | */ |
473 | if (unlikely(time_adjust < 0)) { | 468 | if (unlikely(time_adjust < 0)) |
474 | usec = min(usec, max_ntp_tick); | 469 | usec = min(usec, max_ntp_tick); |
475 | 470 | ||
476 | if (lost) | ||
477 | usec += lost * max_ntp_tick; | ||
478 | } | ||
479 | else if (unlikely(lost)) | ||
480 | usec += lost * tick_usec; | ||
481 | |||
482 | sec = xtime.tv_sec; | 471 | sec = xtime.tv_sec; |
483 | usec += (xtime.tv_nsec / 1000); | 472 | usec += (xtime.tv_nsec / 1000); |
484 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 473 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
@@ -521,8 +510,7 @@ static int sbus_do_settimeofday(struct timespec *tv) | |||
521 | * wall time. Discover what correction gettimeofday() would have | 510 | * wall time. Discover what correction gettimeofday() would have |
522 | * made, and then undo it! | 511 | * made, and then undo it! |
523 | */ | 512 | */ |
524 | nsec -= 1000 * (do_gettimeoffset() + | 513 | nsec -= 1000 * do_gettimeoffset(); |
525 | (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ)); | ||
526 | 514 | ||
527 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 515 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
528 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 516 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |