[tip: timers/core] ntp: Move pps_fbase into ntp_data
From: tip-bot2 for Thomas Gleixner
Date: Wed Oct 02 2024 - 11:45:37 EST
The following commit has been merged into the timers/core branch of tip:
Commit-ID: db45e9bce8df2396740c0c03906ad6ed63948a8b
Gitweb: https://git.kernel.org/tip/db45e9bce8df2396740c0c03906ad6ed63948a8b
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
AuthorDate: Wed, 11 Sep 2024 15:17:54 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitterDate: Wed, 02 Oct 2024 16:53:40 +02:00
ntp: Move pps_fbase into ntp_data
Continue the conversion from static variables to struct based data.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: John Stultz <jstultz@xxxxxxxxxx>
Link: https://lore.kernel.org/all/20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-18-2d52f4e13476@xxxxxxxxxxxxx
---
kernel/time/ntp.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 576f86a..4bde69c 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -43,6 +43,7 @@
* @pps_valid: PPS signal watchdog counter
* @pps_tf: PPS phase median filter
* @pps_jitter: PPS current jitter in nanoseconds
+ * @pps_fbase: PPS beginning of the last freq interval
*
* Protected by the timekeeping locks.
*/
@@ -65,6 +66,7 @@ struct ntp_data {
int pps_valid;
long pps_tf[3];
long pps_jitter;
+ struct timespec64 pps_fbase;
#endif
};
@@ -100,7 +102,6 @@ static struct ntp_data tk_ntp_data = {
intervals to decrease it */
#define PPS_MAXWANDER 100000 /* max PPS freq wander (ns/s) */
-static struct timespec64 pps_fbase; /* beginning of the last freq interval */
static int pps_shift; /* current interval duration (s) (shift) */
static int pps_intcnt; /* interval counter */
static s64 pps_freq; /* frequency offset (scaled ns/s) */
@@ -144,7 +145,7 @@ static inline void pps_clear(struct ntp_data *ntpdata)
ntpdata->pps_tf[0] = 0;
ntpdata->pps_tf[1] = 0;
ntpdata->pps_tf[2] = 0;
- pps_fbase.tv_sec = pps_fbase.tv_nsec = 0;
+ ntpdata->pps_fbase.tv_sec = ntpdata->pps_fbase.tv_nsec = 0;
pps_freq = 0;
}
@@ -1045,13 +1046,13 @@ void __hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_t
* When called for the first time, just start the frequency
* interval
*/
- if (unlikely(pps_fbase.tv_sec == 0)) {
- pps_fbase = *raw_ts;
+ if (unlikely(ntpdata->pps_fbase.tv_sec == 0)) {
+ ntpdata->pps_fbase = *raw_ts;
return;
}
/* Ok, now we have a base for frequency calculation */
- freq_norm = pps_normalize_ts(timespec64_sub(*raw_ts, pps_fbase));
+ freq_norm = pps_normalize_ts(timespec64_sub(*raw_ts, ntpdata->pps_fbase));
/*
* Check that the signal is in the range
@@ -1061,7 +1062,7 @@ void __hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_t
(freq_norm.nsec < -MAXFREQ * freq_norm.sec)) {
ntpdata->time_status |= STA_PPSJITTER;
/* Restart the frequency calibration interval */
- pps_fbase = *raw_ts;
+ ntpdata->pps_fbase = *raw_ts;
printk_deferred(KERN_ERR "hardpps: PPSJITTER: bad pulse\n");
return;
}
@@ -1070,7 +1071,7 @@ void __hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_t
if (freq_norm.sec >= (1 << pps_shift)) {
pps_calcnt++;
/* Restart the frequency calibration interval */
- pps_fbase = *raw_ts;
+ ntpdata->pps_fbase = *raw_ts;
hardpps_update_freq(ntpdata, freq_norm);
}