Skip site navigation (1)Skip section navigation (2)
Date:      Mon,  7 Feb 2022 18:00:43 +0100
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        freebsd-hackers@freebsd.org
Subject:   [PATCH] kern_ntptime.c: Remove ntp_init()
Message-ID:  <20220207170043.62630-1-sebastian.huber@embedded-brains.de>

next in thread | raw e-mail | index | archive | help
The ntp_init() function did set a couple of global objects to zero.  Thes=
e
objects are in the .bss section and already initialized to zero during ke=
rnel
or module loading.
---
 sys/kern/kern_ntptime.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index a8418248abd7..96f14a408bcb 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -207,7 +207,6 @@ static long pps_errcnt;			/* calibration errors */
  * End of phase/frequency-lock loop (PLL/FLL) definitions
  */
=20
-static void ntp_init(void);
 static void hardupdate(long offset);
 static void ntp_gettime1(struct ntptimeval *ntvp);
 static bool ntp_is_time_error(int tsl);
@@ -632,39 +631,6 @@ ntp_update_second(int64_t *adjustment, time_t *newse=
c)
 	NTP_UNLOCK();
 }
=20
-/*
- * ntp_init() - initialize variables and structures
- *
- * This routine must be called after the kernel variables hz and tick
- * are set or changed and before the next tick interrupt. In this
- * particular implementation, these values are assumed set elsewhere in
- * the kernel. The design allows the clock frequency and tick interval
- * to be changed while the system is running. So, this routine should
- * probably be integrated with the code that does that.
- */
-static void
-ntp_init(void)
-{
-
-	/*
-	 * The following variables are initialized only at startup. Only
-	 * those structures not cleared by the compiler need to be
-	 * initialized, and these only in the simulator. In the actual
-	 * kernel, any nonzero values here will quickly evaporate.
-	 */
-	L_CLR(time_offset);
-	L_CLR(time_freq);
-#ifdef PPS_SYNC
-	pps_tf[0].tv_sec =3D pps_tf[0].tv_nsec =3D 0;
-	pps_tf[1].tv_sec =3D pps_tf[1].tv_nsec =3D 0;
-	pps_tf[2].tv_sec =3D pps_tf[2].tv_nsec =3D 0;
-	pps_fcount =3D 0;
-	L_CLR(pps_freq);
-#endif /* PPS_SYNC */	  =20
-}
-
-SYSINIT(ntpclocks, SI_SUB_CLOCKS, SI_ORDER_MIDDLE, ntp_init, NULL);
-
 /*
  * hardupdate() - local clock update
  *
--=20
2.26.2




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220207170043.62630-1-sebastian.huber>