Commit f02606c8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] arm26: fix do_settimeofday() for new API

parent a9a93c8a
......@@ -148,8 +148,11 @@ void do_gettimeofday(struct timeval *tv)
tv->tv_usec = usec;
}
void do_settimeofday(struct timeval *tv)
int do_settimeofday(struct timespec *tv)
{
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
write_seqlock_irq(&xtime_lock);
/*
* This is revolting. We need to set "xtime" correctly. However, the
......@@ -157,21 +160,22 @@ void do_settimeofday(struct timeval *tv)
* wall time. Discover what correction gettimeofday() would have
* done, and then undo it!
*/
tv->tv_usec -= gettimeoffset();
tv->tv_usec -= (jiffies - wall_jiffies) * USECS_PER_JIFFY;
tv->tv_nsec -= 1000 * (gettimeoffset() +
(jiffies - wall_jiffies) * USECS_PER_JIFFY);
while (tv->tv_usec < 0) {
tv->tv_usec += 1000000;
while (tv->tv_nsec < 0) {
tv->tv_nsec += NSEC_PER_SEC;
tv->tv_sec--;
}
xtime.tv_sec = tv->tv_sec;
xtime.tv_nsec = tv->tv_usec * 1000;
xtime.tv_nsec = tv->tv_nsec;
time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC;
time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT;
write_sequnlock_irq(&xtime_lock);
return 0;
}
static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment