Commit 54095a6e authored by Giovambattista Pulcini's avatar Giovambattista Pulcini Committed by Linus Torvalds

[PATCH] ppc32: Fix a problem with NTP on !(chrp||gemini)

The following problem was found by Giovambattista Pulcini
<gpulcini@swintel.it>, who also provided a partial patch, and this has been
verified by our time guru Gabriel Paubert <paubert@iram.es>.

The problem is that in do_settimeofday() we always set time_state to
TIME_ERROR and except on two platforms, never re-set it.  This meant that
ntp_gettime() and ntp_adjtime() always returned TIME_ERROR, incorrectly. 
Based on Gabriel's analysis, time_state is used for leap-second processing,
and ppc shouldn't be mucking with it.
Signed-off-by: default avatarTom Rini <trini@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fd16230a
...@@ -272,7 +272,6 @@ int do_settimeofday(struct timespec *tv) ...@@ -272,7 +272,6 @@ int do_settimeofday(struct timespec *tv)
time_adjust = 0; /* stop active adjtime() */ time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC; time_status |= STA_UNSYNC;
time_state = TIME_ERROR; /* p. 24, (a) */
time_maxerror = NTP_PHASE_LIMIT; time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT;
write_sequnlock_irqrestore(&xtime_lock, flags); write_sequnlock_irqrestore(&xtime_lock, flags);
......
...@@ -115,8 +115,6 @@ int __chrp chrp_set_rtc_time(unsigned long nowtime) ...@@ -115,8 +115,6 @@ int __chrp chrp_set_rtc_time(unsigned long nowtime)
chrp_cmos_clock_write(save_control, RTC_CONTROL); chrp_cmos_clock_write(save_control, RTC_CONTROL);
chrp_cmos_clock_write(save_freq_select, RTC_FREQ_SELECT); chrp_cmos_clock_write(save_freq_select, RTC_FREQ_SELECT);
if ( (time_state == TIME_ERROR) || (time_state == TIME_BAD) )
time_state = TIME_OK;
spin_unlock(&rtc_lock); spin_unlock(&rtc_lock);
return 0; return 0;
} }
......
...@@ -433,9 +433,6 @@ gemini_set_rtc_time( unsigned long now ) ...@@ -433,9 +433,6 @@ gemini_set_rtc_time( unsigned long now )
/* done writing */ /* done writing */
gemini_rtc_write(reg, M48T35_RTC_CONTROL); gemini_rtc_write(reg, M48T35_RTC_CONTROL);
if ((time_state == TIME_ERROR) || (time_state == TIME_BAD))
time_state = TIME_OK;
return 0; return 0;
} }
......
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