aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/pcic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/pcic.c')
-rw-r--r--arch/sparc/kernel/pcic.c16
1 files changed, 2 insertions, 14 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
768extern unsigned long wall_jiffies;
769
770static void pci_do_gettimeofday(struct timeval *tv) 768static 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--;