mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: George Anzinger <george@mvista.com>,
	frank@tuxrocks.com, Anton Blanchard <anton@samba.org>,
	benh@kernel.crashing.org, Nishanth Aravamudan <nacc@us.ibm.com>,
	Roman Zippel <zippel@linux-m68k.org>
Subject: [RFC][PATCH - 3/12] NTP cleanup: Remove unused NTP PPS code
Date: Fri, 15 Jul 2005 19:58:32 -0700	[thread overview]
Message-ID: <1121482713.25236.35.camel@cog.beaverton.ibm.com> (raw)
In-Reply-To: <1121482672.25236.33.camel@cog.beaverton.ibm.com>

All,
	Since the NTP PPS code required an out of tree patch which I don't
believe there is a 2.6 version of, this patch removes the unused PPS
logic in the kernel.

Any comments or feedback would be greatly appreciated.

thanks
-john


linux-2.6.13-rc3_timeofday-ntp-part3_B4.patch
============================================
diff --git a/kernel/ntp.c b/kernel/ntp.c
--- a/kernel/ntp.c
+++ b/kernel/ntp.c
@@ -46,26 +46,9 @@ void time_interpolator_update(long delta
 #define time_interpolator_update(x)
 #endif
 
-
-static long pps_offset;            /* pps time offset (us) */
-static long pps_jitter = MAXTIME;  /* time dispersion (jitter) (us) */
-
-static long pps_freq;              /* frequency offset (scaled ppm) */
-static long pps_stabil = MAXFREQ;  /* frequency dispersion (scaled ppm) */
-
-static long pps_valid = PPS_VALID; /* pps signal watchdog counter */
-
-static int pps_shift = PPS_SHIFT;  /* interval duration (s) (shift) */
-
-static long pps_jitcnt;            /* jitter limit exceeded */
-static long pps_calcnt;            /* calibration intervals */
-static long pps_errcnt;            /* calibration errors */
-static long pps_stbcnt;            /* stability limit exceeded */
-
 /* Don't completely fail for HZ > 500.  */
 int tickadj = 500/HZ ? : 1;		/* microsecs */
 
-
 /*
  * phase-lock loop variables
  */
@@ -235,21 +218,7 @@ void second_overflow(void)
 		time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
 	}
 
-	/*
-	 * Compute the frequency estimate and additional phase
-	 * adjustment due to frequency error for the next
-	 * second. When the PPS signal is engaged, gnaw on the
-	 * watchdog counter and update the frequency computed by
-	 * the pll and the PPS signal.
-	 */
-	pps_valid++;
-	if (pps_valid == PPS_VALID) {	/* PPS signal lost */
-		pps_jitter = MAXTIME;
-		pps_stabil = MAXFREQ;
-		time_status &= ~(STA_PPSSIGNAL | STA_PPSJITTER |
-			STA_PPSWANDER | STA_PPSERROR);
-	}
-	ltemp = time_freq + pps_freq;
+	ltemp = time_freq;
 	if (ltemp < 0)
 		time_adj -= -ltemp >> (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE);
 	else
@@ -307,10 +276,6 @@ int ntp_adjtimex(struct timex *txc)
 	/* Save for later - semantics of adjtime is to return old value */
 	save_adjust = time_next_adjust ? time_next_adjust : time_adjust;
 
-#if 0	/* STA_CLOCKERR is never set yet */
-	time_status &= ~STA_CLOCKERR;		/* reset STA_CLOCKERR */
-#endif
-
 	/* If there are input parameters, then process them */
 	if (txc->modes)	{
 		if (txc->modes & ADJ_STATUS)	/* only set allowed bits */
@@ -322,7 +287,7 @@ int ntp_adjtimex(struct timex *txc)
 				result = -EINVAL;
 				goto leave;
 			}
-			time_freq = txc->freq - pps_freq;
+			time_freq = txc->freq;
 		}
 
 		if (txc->modes & ADJ_MAXERROR) {
@@ -356,11 +321,8 @@ int ntp_adjtimex(struct timex *txc)
 				/* adjtime() is independent from ntp_adjtime() */
 				if ((time_next_adjust = txc->offset) == 0)
 					time_adjust = 0;
-			} else if ( time_status & (STA_PLL | STA_PPSTIME) ) {
-				ltemp = (time_status
-					& (STA_PPSTIME | STA_PPSSIGNAL))
-					== (STA_PPSTIME | STA_PPSSIGNAL) ?
-			            pps_offset : txc->offset;
+			} else if (time_status & STA_PLL) {
+				ltemp = txc->offset;
 
 				/*
 				 * Scale the phase adjustment and
@@ -415,7 +377,7 @@ int ntp_adjtimex(struct timex *txc)
 					time_freq = time_tolerance;
 				else if (time_freq < -time_tolerance)
 					time_freq = -time_tolerance;
-			} /* STA_PLL || STA_PPSTIME */
+			} /* STA_PLL */
 		} /* txc->modes & ADJ_OFFSET */
 
 		if (txc->modes & ADJ_TICK) {
@@ -425,17 +387,8 @@ int ntp_adjtimex(struct timex *txc)
 	} /* txc->modes */
 leave:
 
-	if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0
-		|| ((time_status & (STA_PPSFREQ|STA_PPSTIME)) != 0
-		&& (time_status & STA_PPSSIGNAL) == 0)
-		/* p. 24, (b) */
-		|| ((time_status & (STA_PPSTIME|STA_PPSJITTER))
-		== (STA_PPSTIME|STA_PPSJITTER))
-		/* p. 24, (c) */
-		|| ((time_status & STA_PPSFREQ) != 0
-		&& (time_status & (STA_PPSWANDER|STA_PPSERROR)) != 0))
-		/* p. 24, (d) */
-			result = TIME_ERROR;
+	if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
+		result = TIME_ERROR;
 
 	if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
 		txc->offset = save_adjust;
@@ -445,7 +398,7 @@ leave:
 		else
 			txc->offset = time_offset >> SHIFT_UPDATE;
 	}
-	txc->freq = time_freq + pps_freq;
+	txc->freq = time_freq;
 	txc->maxerror = time_maxerror;
 	txc->esterror = time_esterror;
 	txc->status = time_status;
@@ -453,14 +406,17 @@ leave:
 	txc->precision = time_precision;
 	txc->tolerance = time_tolerance;
 	txc->tick = tick_usec;
-	txc->ppsfreq = pps_freq;
-	txc->jitter = pps_jitter >> PPS_AVG;
-	txc->shift = pps_shift;
-	txc->stabil = pps_stabil;
-	txc->jitcnt = pps_jitcnt;
-	txc->calcnt = pps_calcnt;
-	txc->errcnt = pps_errcnt;
-	txc->stbcnt = pps_stbcnt;
+
+	/* PPS is not implemented, so these are zero */
+	txc->ppsfreq = 0;
+	txc->jitter = 0;
+	txc->shift = 0;
+	txc->stabil = 0;
+	txc->jitcnt = 0;
+	txc->calcnt = 0;
+	txc->errcnt = 0;
+	txc->stbcnt = 0;
+
 	write_sequnlock_irq(&xtime_lock);
 	do_gettimeofday(&txc->time);
 	return result;



  reply	other threads:[~2005-07-16  3:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-16  2:55 [RFC - 0/12] NTP cleanup work (v. B4) john stultz
2005-07-16  2:57 ` [RFC][PATCH - 1/12] NTP cleanup: Move NTP code into ntp.c john stultz
2005-07-16  2:57   ` [RFC][PATCH - 2/12] NTP cleanup: Move arches to new ntp interfaces john stultz
2005-07-16  2:58     ` john stultz [this message]
2005-07-16  2:59       ` [RFC][PATCH - 4/12] NTP cleanup: Breakup ntp_adjtimex() john stultz
2005-07-16  3:00         ` [RFC][PATCH - 5/12] NTP cleanup: Break out leapsecond processing john stultz
2005-07-16  3:02           ` [RFC][PATCH - 6/12] NTP cleanup: Clean up ntp_adjtimex() arguement checking john stultz
2005-07-16  3:04             ` [RFC][PATCH - 7/12] NTP cleanup: Cleanup signed shifting logic john stultz
2005-07-16  3:05               ` [RFC][PATCH - 8/12] NTP cleanup: Integrate second_overflow() logic john stultz
2005-07-16  3:06                 ` [RFC][PATCH - 9/12] NTP cleanup: Improve NTP variable names john stultz
2005-07-16  3:06                   ` [RFC][PATCH - 10/12] NTP cleanup: Use ntp_lock instead of xtime_lock john stultz
2005-07-16  3:07                     ` [RFC][PATCH - 11/12] NTP cleanup: Introduce PPM adjustment variables john stultz
2005-07-16  3:09                       ` [RFC][PATCH - 12/12] NTP cleanup: use ppm instead of unit adj returned by ntp_advance john stultz
2005-07-18 11:42   ` [RFC][PATCH - 1/12] NTP cleanup: Move NTP code into ntp.c Pavel Machek
2005-07-20 20:44     ` john stultz
2005-07-17 18:00 ` [RFC - 0/12] NTP cleanup work (v. B4) Roman Zippel
2005-07-20 16:26   ` john stultz
2005-07-21 10:39     ` Roman Zippel
2005-07-26  1:03       ` john stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1121482713.25236.35.camel@cog.beaverton.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=frank@tuxrocks.com \
    --cc=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nacc@us.ibm.com \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®