From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
John Stultz <jstultz@google.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] ntp: Convert functions with only two states to bool
Date: Wed, 02 Oct 2024 15:44:55 -0000 [thread overview]
Message-ID: <172788389516.1442.2315987124482723471.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-5-2d52f4e13476@linutronix.de>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 48c3c65f64b01164f1704b40b38f60837d484f13
Gitweb: https://git.kernel.org/tip/48c3c65f64b01164f1704b40b38f60837d484f13
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 11 Sep 2024 15:17:41 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Oct 2024 16:53:39 +02:00
ntp: Convert functions with only two states to bool
is_error_status() and ntp_synced() return whether a state is set or
not. Both functions use unsigned int for it even if it would be a perfect
job for a bool.
Use bool instead of unsigned int. And while at it, move ntp_synced()
function to the place where it is used.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-5-2d52f4e13476@linutronix.de
---
kernel/time/ntp.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index bf2f6ee..905b021 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -171,7 +171,7 @@ static inline void pps_set_freq(s64 freq)
pps_freq = freq;
}
-static inline int is_error_status(int status)
+static inline bool is_error_status(int status)
{
return (status & (STA_UNSYNC|STA_CLOCKERR))
/*
@@ -221,7 +221,7 @@ static inline void pps_clear(void) {}
static inline void pps_dec_valid(void) {}
static inline void pps_set_freq(s64 freq) {}
-static inline int is_error_status(int status)
+static inline bool is_error_status(int status)
{
return status & (STA_UNSYNC|STA_CLOCKERR);
}
@@ -241,21 +241,6 @@ static inline void pps_fill_timex(struct __kernel_timex *txc)
#endif /* CONFIG_NTP_PPS */
-
-/**
- * ntp_synced - Returns 1 if the NTP status is not UNSYNC
- *
- */
-static inline int ntp_synced(void)
-{
- return !(time_status & STA_UNSYNC);
-}
-
-
-/*
- * NTP methods:
- */
-
/*
* Update tick_length and tick_length_base, based on tick_usec, ntp_tick_adj and
* time_freq:
@@ -609,6 +594,15 @@ static inline int update_rtc(struct timespec64 *to_set, unsigned long *offset_ns
}
#endif
+/**
+ * ntp_synced - Tells whether the NTP status is not UNSYNC
+ * Returns: true if not UNSYNC, false otherwise
+ */
+static inline bool ntp_synced(void)
+{
+ return !(time_status & STA_UNSYNC);
+}
+
/*
* If we have an externally synchronized Linux clock, then update RTC clock
* accordingly every ~11 minutes. Generally RTCs can only store second
next prev parent reply other threads:[~2024-10-02 15:44 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 13:17 [PATCH 00/21] ntp: Rework to prepare support of indenpendent PTP clocks Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 01/21] ntp: Remove unused tick_nsec Anna-Maria Behnsen
2024-09-11 20:06 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 02/21] ntp: Make tick_usec static Anna-Maria Behnsen
2024-09-11 20:28 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 03/21] ntp: Clean up comments Anna-Maria Behnsen
2024-09-11 20:08 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 04/21] ntp: Cleanup formatting of code Anna-Maria Behnsen
2024-09-11 20:11 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 05/21] ntp: Convert functions with only two states to bool Anna-Maria Behnsen
2024-09-11 20:12 ` John Stultz
2024-10-02 15:44 ` tip-bot2 for Thomas Gleixner [this message]
2024-09-11 13:17 ` [PATCH 06/21] ntp: Read reference time only once Anna-Maria Behnsen
2024-09-11 20:00 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 07/21] ntp: Introduce struct ntp_data Anna-Maria Behnsen
2024-09-11 20:20 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 08/21] ntp: Move tick_length* into ntp_data Anna-Maria Behnsen
2024-09-11 20:23 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 09/21] ntp: Move tick_stat* " Anna-Maria Behnsen
2024-09-11 20:25 ` John Stultz
2024-10-02 15:44 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-09-11 13:17 ` [PATCH 10/21] ntp: Move time_offset/constant " Anna-Maria Behnsen
2024-09-11 20:27 ` John Stultz
2024-09-11 13:17 ` [PATCH 11/21] ntp: Move time_max/esterror " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 12/21] ntp: Move time_freq/reftime " Anna-Maria Behnsen
2024-09-11 20:30 ` John Stultz
2024-09-11 13:17 ` [PATCH 13/21] ntp: Move time_adj/ntp_tick_adj " Anna-Maria Behnsen
2024-09-11 20:36 ` John Stultz
2024-09-11 13:17 ` [PATCH 14/21] ntp: Move ntp_next_leap_sec " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 15/21] ntp: Move pps_valid " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 16/21] ntp: Move pps_ft " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 17/21] ntp: Move pps_jitter " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 18/21] ntp: Move pps_fbase " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 19/21] ntp: Move pps_shift/intcnt " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 20/21] ntp: Move pps_freq/stabil " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 21/21] ntp: Move pps monitors " Anna-Maria Behnsen
2024-09-12 8:12 ` [PATCH 00/21] ntp: Rework to prepare support of indenpendent PTP clocks Miroslav Lichvar
2024-09-13 3:59 ` Richard Cochran
2024-09-13 10:28 ` Anna-Maria Behnsen
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=172788389516.1442.2315987124482723471.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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®