Skip to contentSkip to conversation

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

PATCH New [email protected] 1 participant 1 message Apr 13, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 37/198 ppc32: Fix a problem with NTP on !(chrp||gemini)

From: Giovambattista Pulcini <[email protected]>

The following problem was found by Giovambattista Pulcini <[email protected]>, who also provided a partial patch, and this has been verified by our time guru Gabriel Paubert <[email protected]>.

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.

---

 25-akpm/arch/ppc/kernel/time.c            |    1 -
 25-akpm/arch/ppc/platforms/chrp_time.c    |    2 --
 25-akpm/arch/ppc/platforms/gemini_setup.c |    3 ---
 3 files changed, 6 deletions(-)
arch/ppc/kernel/time.c renamed from arch/ppc/kernel/time.c~ppc32-fix-a-problem-with-ntp-on-chrpgemini +0 -1
diff -puN arch/ppc/kernel/time.c~ppc32-fix-a-problem-with-ntp-on-chrpgemini arch/ppc/kernel/time.c
@@ -272,7 +272,6 @@ int do_settimeofday(struct timespec *tv)
 
 	time_adjust = 0;                /* stop active adjtime() */
 	time_status |= STA_UNSYNC;
-	time_state = TIME_ERROR;        /* p. 24, (a) */
 	time_maxerror = NTP_PHASE_LIMIT;
 	time_esterror = NTP_PHASE_LIMIT;
 	write_sequnlock_irqrestore(&xtime_lock, flags);
arch/ppc/platforms/chrp_time.c renamed from arch/ppc/platforms/chrp_time.c~ppc32-fix-a-problem-with-ntp-on-chrpgemini +0 -2
diff -puN arch/ppc/platforms/chrp_time.c~ppc32-fix-a-problem-with-ntp-on-chrpgemini arch/ppc/platforms/chrp_time.c
@@ -115,8 +115,6 @@ int __chrp chrp_set_rtc_time(unsigned lo
 	chrp_cmos_clock_write(save_control, RTC_CONTROL);
 	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);
 	return 0;
 }
arch/ppc/platforms/gemini_setup.c renamed from arch/ppc/platforms/gemini_setup.c~ppc32-fix-a-problem-with-ntp-on-chrpgemini +0 -3
diff -puN arch/ppc/platforms/gemini_setup.c~ppc32-fix-a-problem-with-ntp-on-chrpgemini arch/ppc/platforms/gemini_setup.c
@@ -433,9 +433,6 @@ gemini_set_rtc_time( unsigned long now )
 	/* done writing */
 	gemini_rtc_write(reg, M48T35_RTC_CONTROL);
 
-	if ((time_state == TIME_ERROR) || (time_state == TIME_BAD))
-		time_state = TIME_OK;
-
 	return 0;
 }
 

_