From nobody Sat Nov 30 07:26:41 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B45119EEB7; Wed, 11 Sep 2024 13:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726060685; cv=none; b=ddf/lQ2lJYF1faaKPioELvDyrb4uPlqeFUsRLBFtPp5CHftFXa629IpjJnRfUSmODzihJMrzSdfp6j8+tuBYml/1FYL2VHFHLa2S08fbh6/MdposSt2C1hEve8qpGa362piyG8CMZqZ5iAc3GknZBFoJyzIZ6sK0uqyYyGCDfXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726060685; c=relaxed/simple; bh=ZoDFUf51l3H/WcLUcto7GVyoIeSg8tr4rsTPyE8PgEA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i6IPLMoOWA+bwZ/ScB+1druQOVDmVZtfUEEt6BetsiCdnt16cPkrTy8hB52FTYbh1yLS3hL8f+YBI+zrL/OJPxThMHffpFul9uvZBelhrSikEq/2v9UNS8TwY4CphuW6hsudVnBGVbL0Vv1SQK3fMvGNzeKwNyv/AonQNNFYgQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=YvfEe/zG; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=702zThgt; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YvfEe/zG"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="702zThgt" From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1726060676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RlMdE3TYxqwLQSPlWb5h5InAD5kxN3qEYqa3UzZv1H4=; b=YvfEe/zGyYVbCBvGYLsDPbElSggfoeheuMRR89HFnIc4zinbMBuGHTJcvjEUUk7b/XUrKJ 3tpuYCAAaB4XDxFQ0FV+F0E9RPs8C+pNvSoCi0vPlEsT9LoscQe4ZjkRZcirIMOqkLoflL +CwQdtGjM/3iCvLHWxAiNU1HBgoKzQkPbK6VC7Db2TwXYnw5+jwuCpJWgb84yTRYSn9yX4 wCFHxXaw3H/UT9+5+6Ke+y82o+19g0vyY+yJai6bvwB7apqtNo5Off4QLEIJwd3bY+lENE FVBNLmGvZ0kBXLPlvw2KmzRBTYwXVjtNXje6hZW4YT35C8jGxFm5lqZzjtFe9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1726060676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RlMdE3TYxqwLQSPlWb5h5InAD5kxN3qEYqa3UzZv1H4=; b=702zThgtCf5z/yjodhZKpcCXV5FOjH0Uvr6FuG3TPmUg/ivBDs9J007iGs3X6wG7aUYnRm 4lIOXN6jHFOSWGDg== Date: Wed, 11 Sep 2024 15:17:45 +0200 Subject: [PATCH 09/21] ntp: Move tick_stat* into ntp_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-9-2d52f4e13476@linutronix.de> References: <20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-0-2d52f4e13476@linutronix.de> In-Reply-To: <20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-0-2d52f4e13476@linutronix.de> To: John Stultz , Frederic Weisbecker , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Miroslav Lichvar , Richard Cochran , Christopher S Hall , Anna-Maria Behnsen From: Thomas Gleixner Continue the conversion from static variables to struct based data. No functional change. Signed-off-by: Thomas Gleixner Signed-off-by: Anna-Maria Behnsen Acked-by: John Stultz --- kernel/time/ntp.c | 175 ++++++++++++++++++++++++++------------------------= ---- 1 file changed, 85 insertions(+), 90 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 6c5f684328c8..6d87f9889b03 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -27,6 +27,8 @@ * @tick_usec: USER_HZ period in microseconds * @tick_length: Adjusted tick length * @tick_length_base: Base value for @tick_length + * @time_state: State of the clock synchronization + * @time_status: Clock status bits * * Protected by the timekeeping locks. */ @@ -34,10 +36,14 @@ struct ntp_data { unsigned long tick_usec; u64 tick_length; u64 tick_length_base; + int time_state; + int time_status; }; =20 static struct ntp_data tk_ntp_data =3D { .tick_usec =3D USER_TICK_USEC, + .time_state =3D TIME_OK, + .time_status =3D STA_UNSYNC, }; =20 #define SECS_PER_DAY 86400 @@ -53,16 +59,6 @@ static struct ntp_data tk_ntp_data =3D { * estimated error =3D NTP dispersion. */ =20 -/* - * clock synchronization status - * - * (TIME_ERROR prevents overwriting the CMOS clock) - */ -static int time_state =3D TIME_OK; - -/* clock status bits: */ -static int time_status =3D STA_UNSYNC; - /* time adjustment (nsecs): */ static s64 time_offset; =20 @@ -127,9 +123,9 @@ static long pps_errcnt; /* calibration errors */ * PPS kernel consumer compensates the whole phase error immediately. * Otherwise, reduce the offset by a fixed factor times the time constant. */ -static inline s64 ntp_offset_chunk(s64 offset) +static inline s64 ntp_offset_chunk(struct ntp_data *ntpdata, s64 offset) { - if (time_status & STA_PPSTIME && time_status & STA_PPSSIGNAL) + if (ntpdata->time_status & STA_PPSTIME && ntpdata->time_status & STA_PPSS= IGNAL) return offset; else return shift_right(offset, SHIFT_PLL + time_constant); @@ -159,13 +155,13 @@ static inline void pps_clear(void) * Decrease pps_valid to indicate that another second has passed since the * last PPS signal. When it reaches 0, indicate that PPS signal is missing. */ -static inline void pps_dec_valid(void) +static inline void pps_dec_valid(struct ntp_data *ntpdata) { if (pps_valid > 0) pps_valid--; else { - time_status &=3D ~(STA_PPSSIGNAL | STA_PPSJITTER | - STA_PPSWANDER | STA_PPSERROR); + ntpdata->time_status &=3D ~(STA_PPSSIGNAL | STA_PPSJITTER | + STA_PPSWANDER | STA_PPSERROR); pps_clear(); } } @@ -198,12 +194,12 @@ static inline bool is_error_status(int status) && (status & (STA_PPSWANDER|STA_PPSERROR))); } =20 -static inline void pps_fill_timex(struct __kernel_timex *txc) +static inline void pps_fill_timex(struct ntp_data *ntpdata, struct __kerne= l_timex *txc) { txc->ppsfreq =3D shift_right((pps_freq >> PPM_SCALE_INV_SHIFT) * PPM_SCALE_INV, NTP_SCALE_SHIFT); txc->jitter =3D pps_jitter; - if (!(time_status & STA_NANO)) + if (!(ntpdata->time_status & STA_NANO)) txc->jitter =3D pps_jitter / NSEC_PER_USEC; txc->shift =3D pps_shift; txc->stabil =3D pps_stabil; @@ -215,14 +211,14 @@ static inline void pps_fill_timex(struct __kernel_tim= ex *txc) =20 #else /* !CONFIG_NTP_PPS */ =20 -static inline s64 ntp_offset_chunk(s64 offset) +static inline s64 ntp_offset_chunk(struct ntp_data *ntp, s64 offset) { return shift_right(offset, SHIFT_PLL + time_constant); } =20 static inline void pps_reset_freq_interval(void) {} static inline void pps_clear(void) {} -static inline void pps_dec_valid(void) {} +static inline void pps_dec_valid(struct ntp_data *ntpdata) {} static inline void pps_set_freq(s64 freq) {} =20 static inline bool is_error_status(int status) @@ -230,7 +226,7 @@ static inline bool is_error_status(int status) return status & (STA_UNSYNC|STA_CLOCKERR); } =20 -static inline void pps_fill_timex(struct __kernel_timex *txc) +static inline void pps_fill_timex(struct ntp_data *ntpdata, struct __kerne= l_timex *txc) { /* PPS is not implemented, so these are zero */ txc->ppsfreq =3D 0; @@ -268,30 +264,30 @@ static void ntp_update_frequency(struct ntp_data *ntp= data) ntpdata->tick_length_base =3D new_base; } =20 -static inline s64 ntp_update_offset_fll(s64 offset64, long secs) +static inline s64 ntp_update_offset_fll(struct ntp_data *ntpdata, s64 offs= et64, long secs) { - time_status &=3D ~STA_MODE; + ntpdata->time_status &=3D ~STA_MODE; =20 if (secs < MINSEC) return 0; =20 - if (!(time_status & STA_FLL) && (secs <=3D MAXSEC)) + if (!(ntpdata->time_status & STA_FLL) && (secs <=3D MAXSEC)) return 0; =20 - time_status |=3D STA_MODE; + ntpdata->time_status |=3D STA_MODE; =20 return div64_long(offset64 << (NTP_SCALE_SHIFT - SHIFT_FLL), secs); } =20 -static void ntp_update_offset(long offset) +static void ntp_update_offset(struct ntp_data *ntpdata, long offset) { s64 freq_adj, offset64; long secs, real_secs; =20 - if (!(time_status & STA_PLL)) + if (!(ntpdata->time_status & STA_PLL)) return; =20 - if (!(time_status & STA_NANO)) { + if (!(ntpdata->time_status & STA_NANO)) { /* Make sure the multiplication below won't overflow */ offset =3D clamp(offset, -USEC_PER_SEC, USEC_PER_SEC); offset *=3D NSEC_PER_USEC; @@ -306,13 +302,13 @@ static void ntp_update_offset(long offset) */ real_secs =3D __ktime_get_real_seconds(); secs =3D (long)(real_secs - time_reftime); - if (unlikely(time_status & STA_FREQHOLD)) + if (unlikely(ntpdata->time_status & STA_FREQHOLD)) secs =3D 0; =20 time_reftime =3D real_secs; =20 offset64 =3D offset; - freq_adj =3D ntp_update_offset_fll(offset64, secs); + freq_adj =3D ntp_update_offset_fll(ntpdata, offset64, secs); =20 /* * Clamp update interval to reduce PLL gain with low @@ -335,10 +331,10 @@ static void ntp_update_offset(long offset) static void __ntp_clear(struct ntp_data *ntpdata) { /* Stop active adjtime() */ - time_adjust =3D 0; - time_status |=3D STA_UNSYNC; - time_maxerror =3D NTP_PHASE_LIMIT; - time_esterror =3D NTP_PHASE_LIMIT; + time_adjust =3D 0; + ntpdata->time_status |=3D STA_UNSYNC; + time_maxerror =3D NTP_PHASE_LIMIT; + time_esterror =3D NTP_PHASE_LIMIT; =20 ntp_update_frequency(ntpdata); =20 @@ -372,9 +368,10 @@ u64 ntp_tick_length(void) */ ktime_t ntp_get_next_leap(void) { + struct ntp_data *ntpdata =3D &tk_ntp_data; ktime_t ret; =20 - if ((time_state =3D=3D TIME_INS) && (time_status & STA_INS)) + if ((ntpdata->time_state =3D=3D TIME_INS) && (ntpdata->time_status & STA_= INS)) return ktime_set(ntp_next_leap_sec, 0); ret =3D KTIME_MAX; return ret; @@ -402,46 +399,46 @@ int second_overflow(time64_t secs) * day, the system clock is set back one second; if in leap-delete * state, the system clock is set ahead one second. */ - switch (time_state) { + switch (ntpdata->time_state) { case TIME_OK: - if (time_status & STA_INS) { - time_state =3D TIME_INS; + if (ntpdata->time_status & STA_INS) { + ntpdata->time_state =3D TIME_INS; div_s64_rem(secs, SECS_PER_DAY, &rem); ntp_next_leap_sec =3D secs + SECS_PER_DAY - rem; - } else if (time_status & STA_DEL) { - time_state =3D TIME_DEL; + } else if (ntpdata->time_status & STA_DEL) { + ntpdata->time_state =3D TIME_DEL; div_s64_rem(secs + 1, SECS_PER_DAY, &rem); ntp_next_leap_sec =3D secs + SECS_PER_DAY - rem; } break; case TIME_INS: - if (!(time_status & STA_INS)) { + if (!(ntpdata->time_status & STA_INS)) { ntp_next_leap_sec =3D TIME64_MAX; - time_state =3D TIME_OK; + ntpdata->time_state =3D TIME_OK; } else if (secs =3D=3D ntp_next_leap_sec) { leap =3D -1; - time_state =3D TIME_OOP; + ntpdata->time_state =3D TIME_OOP; pr_notice("Clock: inserting leap second 23:59:60 UTC\n"); } break; case TIME_DEL: - if (!(time_status & STA_DEL)) { + if (!(ntpdata->time_status & STA_DEL)) { ntp_next_leap_sec =3D TIME64_MAX; - time_state =3D TIME_OK; + ntpdata->time_state =3D TIME_OK; } else if (secs =3D=3D ntp_next_leap_sec) { leap =3D 1; ntp_next_leap_sec =3D TIME64_MAX; - time_state =3D TIME_WAIT; + ntpdata->time_state =3D TIME_WAIT; pr_notice("Clock: deleting leap second 23:59:59 UTC\n"); } break; case TIME_OOP: ntp_next_leap_sec =3D TIME64_MAX; - time_state =3D TIME_WAIT; + ntpdata->time_state =3D TIME_WAIT; break; case TIME_WAIT: - if (!(time_status & (STA_INS | STA_DEL))) - time_state =3D TIME_OK; + if (!(ntpdata->time_status & (STA_INS | STA_DEL))) + ntpdata->time_state =3D TIME_OK; break; } =20 @@ -449,18 +446,18 @@ int second_overflow(time64_t secs) time_maxerror +=3D MAXFREQ / NSEC_PER_USEC; if (time_maxerror > NTP_PHASE_LIMIT) { time_maxerror =3D NTP_PHASE_LIMIT; - time_status |=3D STA_UNSYNC; + ntpdata->time_status |=3D STA_UNSYNC; } =20 /* Compute the phase adjustment for the next second */ ntpdata->tick_length =3D ntpdata->tick_length_base; =20 - delta =3D ntp_offset_chunk(time_offset); + delta =3D ntp_offset_chunk(ntpdata, time_offset); time_offset -=3D delta; ntpdata->tick_length +=3D delta; =20 /* Check PPS signal */ - pps_dec_valid(); + pps_dec_valid(ntpdata); =20 if (!time_adjust) goto out; @@ -608,7 +605,7 @@ static inline int update_rtc(struct timespec64 *to_set,= unsigned long *offset_ns */ static inline bool ntp_synced(void) { - return !(time_status & STA_UNSYNC); + return !(tk_ntp_data.time_status & STA_UNSYNC); } =20 /* @@ -683,11 +680,11 @@ static inline void __init ntp_init_cmos_sync(void) { } /* * Propagate a new txc->status value into the NTP state: */ -static inline void process_adj_status(const struct __kernel_timex *txc) +static inline void process_adj_status(struct ntp_data *ntpdata, const stru= ct __kernel_timex *txc) { - if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) { - time_state =3D TIME_OK; - time_status =3D STA_UNSYNC; + if ((ntpdata->time_status & STA_PLL) && !(txc->status & STA_PLL)) { + ntpdata->time_state =3D TIME_OK; + ntpdata->time_status =3D STA_UNSYNC; ntp_next_leap_sec =3D TIME64_MAX; /* Restart PPS frequency calibration */ pps_reset_freq_interval(); @@ -697,26 +694,25 @@ static inline void process_adj_status(const struct __= kernel_timex *txc) * If we turn on PLL adjustments then reset the * reference time to current time. */ - if (!(time_status & STA_PLL) && (txc->status & STA_PLL)) + if (!(ntpdata->time_status & STA_PLL) && (txc->status & STA_PLL)) time_reftime =3D __ktime_get_real_seconds(); =20 - /* Only set allowed bits */ - time_status &=3D STA_RONLY; - time_status |=3D txc->status & ~STA_RONLY; + /* only set allowed bits */ + ntpdata->time_status &=3D STA_RONLY; + ntpdata->time_status |=3D txc->status & ~STA_RONLY; } =20 - static inline void process_adjtimex_modes(struct ntp_data *ntpdata, const = struct __kernel_timex *txc, s32 *time_tai) { if (txc->modes & ADJ_STATUS) - process_adj_status(txc); + process_adj_status(ntpdata, txc); =20 if (txc->modes & ADJ_NANO) - time_status |=3D STA_NANO; + ntpdata->time_status |=3D STA_NANO; =20 if (txc->modes & ADJ_MICRO) - time_status &=3D ~STA_NANO; + ntpdata->time_status &=3D ~STA_NANO; =20 if (txc->modes & ADJ_FREQUENCY) { time_freq =3D txc->freq * PPM_SCALE; @@ -734,17 +730,16 @@ static inline void process_adjtimex_modes(struct ntp_= data *ntpdata, const struct =20 if (txc->modes & ADJ_TIMECONST) { time_constant =3D clamp(txc->constant, 0, MAXTC); - if (!(time_status & STA_NANO)) + if (!(ntpdata->time_status & STA_NANO)) time_constant +=3D 4; time_constant =3D clamp(time_constant, 0, MAXTC); } =20 - if (txc->modes & ADJ_TAI && - txc->constant >=3D 0 && txc->constant <=3D MAX_TAI_OFFSET) + if (txc->modes & ADJ_TAI && txc->constant >=3D 0 && txc->constant <=3D MA= X_TAI_OFFSET) *time_tai =3D txc->constant; =20 if (txc->modes & ADJ_OFFSET) - ntp_update_offset(txc->offset); + ntp_update_offset(ntpdata, txc->offset); =20 if (txc->modes & ADJ_TICK) ntpdata->tick_usec =3D txc->tick; @@ -780,7 +775,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const str= uct timespec64 *ts, if (txc->modes) { audit_ntp_set_old(ad, AUDIT_NTP_OFFSET, time_offset); audit_ntp_set_old(ad, AUDIT_NTP_FREQ, time_freq); - audit_ntp_set_old(ad, AUDIT_NTP_STATUS, time_status); + audit_ntp_set_old(ad, AUDIT_NTP_STATUS, ntpdata->time_status); audit_ntp_set_old(ad, AUDIT_NTP_TAI, *time_tai); audit_ntp_set_old(ad, AUDIT_NTP_TICK, ntpdata->tick_usec); =20 @@ -788,26 +783,26 @@ int __do_adjtimex(struct __kernel_timex *txc, const s= truct timespec64 *ts, =20 audit_ntp_set_new(ad, AUDIT_NTP_OFFSET, time_offset); audit_ntp_set_new(ad, AUDIT_NTP_FREQ, time_freq); - audit_ntp_set_new(ad, AUDIT_NTP_STATUS, time_status); + audit_ntp_set_new(ad, AUDIT_NTP_STATUS, ntpdata->time_status); audit_ntp_set_new(ad, AUDIT_NTP_TAI, *time_tai); audit_ntp_set_new(ad, AUDIT_NTP_TICK, ntpdata->tick_usec); } =20 txc->offset =3D shift_right(time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT); - if (!(time_status & STA_NANO)) + if (!(ntpdata->time_status & STA_NANO)) txc->offset =3D (u32)txc->offset / NSEC_PER_USEC; } =20 - result =3D time_state; - if (is_error_status(time_status)) + result =3D ntpdata->time_state; + if (is_error_status(ntpdata->time_status)) result =3D TIME_ERROR; =20 txc->freq =3D shift_right((time_freq >> PPM_SCALE_INV_SHIFT) * PPM_SCALE_INV, NTP_SCALE_SHIFT); txc->maxerror =3D time_maxerror; txc->esterror =3D time_esterror; - txc->status =3D time_status; + txc->status =3D ntpdata->time_status; txc->constant =3D time_constant; txc->precision =3D 1; txc->tolerance =3D MAXFREQ_SCALED / PPM_SCALE; @@ -815,26 +810,26 @@ int __do_adjtimex(struct __kernel_timex *txc, const s= truct timespec64 *ts, txc->tai =3D *time_tai; =20 /* Fill PPS status fields */ - pps_fill_timex(txc); + pps_fill_timex(ntpdata, txc); =20 txc->time.tv_sec =3D ts->tv_sec; txc->time.tv_usec =3D ts->tv_nsec; - if (!(time_status & STA_NANO)) + if (!(ntpdata->time_status & STA_NANO)) txc->time.tv_usec =3D ts->tv_nsec / NSEC_PER_USEC; =20 /* Handle leapsec adjustments */ if (unlikely(ts->tv_sec >=3D ntp_next_leap_sec)) { - if ((time_state =3D=3D TIME_INS) && (time_status & STA_INS)) { + if ((ntpdata->time_state =3D=3D TIME_INS) && (ntpdata->time_status & STA= _INS)) { result =3D TIME_OOP; txc->tai++; txc->time.tv_sec--; } - if ((time_state =3D=3D TIME_DEL) && (time_status & STA_DEL)) { + if ((ntpdata->time_state =3D=3D TIME_DEL) && (ntpdata->time_status & STA= _DEL)) { result =3D TIME_WAIT; txc->tai--; txc->time.tv_sec++; } - if ((time_state =3D=3D TIME_OOP) && (ts->tv_sec =3D=3D ntp_next_leap_sec= )) + if ((ntpdata->time_state =3D=3D TIME_OOP) && (ts->tv_sec =3D=3D ntp_next= _leap_sec)) result =3D TIME_WAIT; } =20 @@ -939,7 +934,7 @@ static long hardpps_update_freq(struct ntp_data *ntpdat= a, struct pps_normtime fr =20 /* Check if the frequency interval was too long */ if (freq_norm.sec > (2 << pps_shift)) { - time_status |=3D STA_PPSERROR; + ntpdata->time_status |=3D STA_PPSERROR; pps_errcnt++; pps_dec_freq_interval(); printk_deferred(KERN_ERR "hardpps: PPSERROR: interval too long - %lld s\= n", @@ -958,7 +953,7 @@ static long hardpps_update_freq(struct ntp_data *ntpdat= a, struct pps_normtime fr pps_freq =3D ftemp; if (delta > PPS_MAXWANDER || delta < -PPS_MAXWANDER) { printk_deferred(KERN_WARNING "hardpps: PPSWANDER: change=3D%ld\n", delta= ); - time_status |=3D STA_PPSWANDER; + ntpdata->time_status |=3D STA_PPSWANDER; pps_stbcnt++; pps_dec_freq_interval(); } else { @@ -977,7 +972,7 @@ static long hardpps_update_freq(struct ntp_data *ntpdat= a, struct pps_normtime fr NSEC_PER_USEC) - pps_stabil) >> PPS_INTMIN; =20 /* If enabled, the system clock frequency is updated */ - if ((time_status & STA_PPSFREQ) && !(time_status & STA_FREQHOLD)) { + if ((ntpdata->time_status & STA_PPSFREQ) && !(ntpdata->time_status & STA_= FREQHOLD)) { time_freq =3D pps_freq; ntp_update_frequency(ntpdata); } @@ -986,7 +981,7 @@ static long hardpps_update_freq(struct ntp_data *ntpdat= a, struct pps_normtime fr } =20 /* Correct REALTIME clock phase error against PPS signal */ -static void hardpps_update_phase(long error) +static void hardpps_update_phase(struct ntp_data *ntpdata, long error) { long correction =3D -error; long jitter; @@ -1003,9 +998,9 @@ static void hardpps_update_phase(long error) if (jitter > (pps_jitter << PPS_POPCORN)) { printk_deferred(KERN_WARNING "hardpps: PPSJITTER: jitter=3D%ld, limit=3D= %ld\n", jitter, (pps_jitter << PPS_POPCORN)); - time_status |=3D STA_PPSJITTER; + ntpdata->time_status |=3D STA_PPSJITTER; pps_jitcnt++; - } else if (time_status & STA_PPSTIME) { + } else if (ntpdata->time_status & STA_PPSTIME) { /* Correct the time using the phase offset */ time_offset =3D div_s64(((s64)correction) << NTP_SCALE_SHIFT, NTP_INTERV= AL_FREQ); /* Cancel running adjtime() */ @@ -1035,10 +1030,10 @@ void __hardpps(const struct timespec64 *phase_ts, c= onst struct timespec64 *raw_t pts_norm =3D pps_normalize_ts(*phase_ts); =20 /* Clear the error bits, they will be set again if needed */ - time_status &=3D ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR); + ntpdata->time_status &=3D ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR); =20 - /* Indicate signal presence */ - time_status |=3D STA_PPSSIGNAL; + /* indicate signal presence */ + ntpdata->time_status |=3D STA_PPSSIGNAL; pps_valid =3D PPS_VALID; =20 /* @@ -1059,7 +1054,7 @@ void __hardpps(const struct timespec64 *phase_ts, con= st struct timespec64 *raw_t */ if ((freq_norm.sec =3D=3D 0) || (freq_norm.nsec > MAXFREQ * freq_norm.sec= ) || (freq_norm.nsec < -MAXFREQ * freq_norm.sec)) { - time_status |=3D STA_PPSJITTER; + ntpdata->time_status |=3D STA_PPSJITTER; /* Restart the frequency calibration interval */ pps_fbase =3D *raw_ts; printk_deferred(KERN_ERR "hardpps: PPSJITTER: bad pulse\n"); @@ -1074,7 +1069,7 @@ void __hardpps(const struct timespec64 *phase_ts, con= st struct timespec64 *raw_t hardpps_update_freq(ntpdata, freq_norm); } =20 - hardpps_update_phase(pts_norm.nsec); + hardpps_update_phase(ntpdata, pts_norm.nsec); =20 } #endif /* CONFIG_NTP_PPS */ --=20 2.39.2