]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/time/ntp.c
[ARM] 4764/1: [AT91] AT91CAP9 core support
[linux-2.6-omap-h63xx.git] / kernel / time / ntp.c
index cd91237dbfe3c160867e60a12f4251b2bf4679fa..e64efaf957e8485b4d233412a69fdf45a1225691 100644 (file)
@@ -205,7 +205,7 @@ static void sync_cmos_clock(unsigned long dummy)
                return;
 
        getnstimeofday(&now);
-       if (abs(xtime.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2)
+       if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2)
                fail = update_persistent_clock(now);
 
        next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec;
@@ -226,7 +226,7 @@ static void sync_cmos_clock(unsigned long dummy)
 
 static void notify_cmos_timer(void)
 {
-       if (no_sync_cmos_clock)
+       if (!no_sync_cmos_clock)
                mod_timer(&sync_cmos_timer, jiffies + 1);
 }
 
@@ -249,10 +249,12 @@ int do_adjtimex(struct timex *txc)
 
        /* Now we validate the data before disabling interrupts */
 
-       if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
+       if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) {
          /* singleshot must not be used with any other mode bits */
-               if (txc->modes != ADJ_OFFSET_SINGLESHOT)
+               if (txc->modes != ADJ_OFFSET_SINGLESHOT &&
+                                       txc->modes != ADJ_OFFSET_SS_READ)
                        return -EINVAL;
+       }
 
        if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET))
          /* adjustment Offset limited to +- .512 seconds */
@@ -372,7 +374,8 @@ int do_adjtimex(struct timex *txc)
 leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
                result = TIME_ERROR;
 
-       if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
+       if ((txc->modes == ADJ_OFFSET_SINGLESHOT) ||
+                       (txc->modes == ADJ_OFFSET_SS_READ))
                txc->offset = save_adjust;
        else
                txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *