All of lore.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Roman Zippel <zippel@linux-m68k.org>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 5/5] make more ntp values static
Date: Fri, 14 Mar 2008 21:15:01 -0700	[thread overview]
Message-ID: <1205554501.6122.92.camel@localhost.localdomain> (raw)
In-Reply-To: <1205554366.6122.88.camel@localhost.localdomain>


Make time_status, time_maxerror and time_esterror static to ntp.c

Signed-off-by: John Stultz <johnstul@us.ibm.com>


Index: linux-2.6/arch/cris/arch-v32/kernel/time.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/kernel/time.c	2008-02-13 12:07:00.000000000 -0800
+++ linux-2.6/arch/cris/arch-v32/kernel/time.c	2008-03-14 20:13:24.000000000 -0700
@@ -248,8 +248,7 @@ timer_interrupt(int irq, void *dev_id)
 	 * The division here is not time critical since it will run once in
 	 * 11 minutes
 	 */
-	if ((time_status & STA_UNSYNC) == 0 &&
-	    xtime.tv_sec > last_rtc_update + 660 &&
+	if (ntp_synced() && xtime.tv_sec > last_rtc_update + 660 &&
 	    (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 &&
 	    (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) {
 		if (set_rtc_mmss(xtime.tv_sec) == 0)
Index: linux-2.6/arch/mn10300/kernel/rtc.c
===================================================================
--- linux-2.6.orig/arch/mn10300/kernel/rtc.c	2008-02-13 12:07:00.000000000 -0800
+++ linux-2.6/arch/mn10300/kernel/rtc.c	2008-03-14 20:13:24.000000000 -0700
@@ -117,8 +117,7 @@ void check_rtc_time(void)
 	 *   RTC clock accordingly every ~11 minutes. set_rtc_mmss() has to be
 	 *   called as close as possible to 500 ms before the new second starts.
 	 */
-	if ((time_status & STA_UNSYNC) == 0 &&
-	    xtime.tv_sec > last_rtc_update + 660 &&
+	if (ntp_synced() && xtime.tv_sec > last_rtc_update + 660 &&
 	    xtime.tv_nsec / 1000 >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
 	    xtime.tv_nsec / 1000 <= 500000 + ((unsigned) TICK_SIZE) / 2
 	    ) {
Index: linux-2.6/include/linux/timex.h
===================================================================
--- linux-2.6.orig/include/linux/timex.h	2008-03-14 19:21:02.000000000 -0700
+++ linux-2.6/include/linux/timex.h	2008-03-14 20:18:44.000000000 -0700
@@ -206,23 +206,8 @@ extern int tickadj;			/* amount of adjus
 /*
  * phase-lock loop variables
  */
-extern int time_status;		/* clock synchronization status bits */
-extern long time_maxerror;	/* maximum error */
-extern long time_esterror;	/* estimated error */
-
 extern long time_adjust;	/* The amount of adjtime left */
 
-extern void ntp_init(void);
-extern void ntp_clear(void);
-
-/**
- * ntp_synced - Returns 1 if the NTP status is not UNSYNC
- *
- */
-static inline int ntp_synced(void)
-{
-	return !(time_status & STA_UNSYNC);
-}
 
 /* Required to safely shift negative values */
 #define shift_right(x, s) ({	\
@@ -243,6 +228,9 @@ static inline int ntp_synced(void)
 /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
 extern u64 tick_length;
 
+extern void ntp_init(void);
+extern int ntp_synced(void);
+extern void ntp_clear(void);
 extern void second_overflow(void);
 extern void update_ntp_one_tick(void);
 extern int do_adjtimex(struct timex *);
Index: linux-2.6/kernel/time/ntp.c
===================================================================
--- linux-2.6.orig/kernel/time/ntp.c	2008-03-14 20:13:06.000000000 -0700
+++ linux-2.6/kernel/time/ntp.c	2008-03-14 20:15:27.000000000 -0700
@@ -32,13 +32,13 @@ static struct hrtimer	leap_timer;
  */
 /* TIME_ERROR prevents overwriting the CMOS clock */
 static int	time_state = TIME_OK;		/* clock synch status	 */
-int		time_status = STA_UNSYNC;	/* clock status bits	 */
+static int	time_status = STA_UNSYNC;	/* clock status bits	 */
 static long	time_tai;			/* TAI offset (s)	 */
 static s64	time_offset;			/* time adjustment (ns)	 */
 static long	time_constant = 2;		/* pll time constant	 */
-long		time_maxerror = NTP_PHASE_LIMIT;/* maximum error (us)	 */
-long		time_esterror = NTP_PHASE_LIMIT;/* estimated error (us)	 */
-static		s64 time_freq;		/* frequency offset (scaled ns/s)*/
+static long	time_maxerror = NTP_PHASE_LIMIT;/* maximum error (us)	 */
+static long	time_esterror = NTP_PHASE_LIMIT;/* estimated error (us)	 */
+static s64	time_freq;		/* frequency offset (scaled ns/s)*/
 static long	time_reftime;		/* time at last adjustment (s)	 */
 long		time_adjust;
 static long	ntp_tick_adj;
@@ -174,6 +174,15 @@ static enum hrtimer_restart ntp_leap_sec
 	return res;
 }
 
+/**
+ * ntp_synced - Returns 1 if the NTP status is not UNSYNC
+ *
+ */
+int ntp_synced(void)
+{
+	return !(time_status & STA_UNSYNC);
+}
+
 /*
  * this routine handles the overflow of the microsecond field
  *



  reply	other threads:[~2008-03-15  4:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-15  4:04 [PATCH 0/5] time/ntp changes john stultz
2008-03-15  4:05 ` [PATCH 1/5] split clocksource adjustment from clockosurce mult john stultz
2008-03-15  4:06   ` [PATCH 2/5] introduce CLOCK_MONOTONIC_RAW john stultz
2008-03-15  4:10     ` [PATCH 3/5] cleanups ntp.c (from Ingo) john stultz
2008-03-15  4:12       ` [PATCH 4/5] ntp.c code flow clenaups " john stultz
2008-03-15  4:15         ` john stultz [this message]
2008-03-15  5:09           ` [PATCH 5/5] make more ntp values static Roman Zippel
2008-03-15  4:52         ` [PATCH 4/5] ntp.c code flow clenaups (from Ingo) Roman Zippel
2008-03-15  5:04           ` John Stultz
2008-03-15 12:39         ` Ingo Oeser
2008-03-15 17:24           ` Roman Zippel
2008-03-15  5:06       ` [PATCH 3/5] cleanups ntp.c " Roman Zippel
2008-03-15  9:32       ` Jörg-Volker Peetz
2008-03-15 17:23         ` Roman Zippel
2008-03-15  4:50     ` [PATCH 2/5] introduce CLOCK_MONOTONIC_RAW Roman Zippel
2008-03-18  2:03       ` john stultz
2008-03-18  2:27         ` john stultz
2008-03-26  3:41         ` Roman Zippel
2008-03-15  4:28   ` [PATCH 1/5] split clocksource adjustment from clockosurce mult Roman Zippel
2008-03-15  5:07     ` 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=1205554501.6122.92.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.