From: John Stultz <jstultz@google.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <jstultz@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>
Subject: [PATCH] time: Rename CLOCK_SET_* as BASEMASK_*_CLOCK_SET
Date: Thu, 15 Aug 2024 13:03:09 -0700 [thread overview]
Message-ID: <20240815200325.2474604-1-jstultz@google.com> (raw)
In-Reply-To: <874j7y6cwh.ffs@tglx>
In commit 5916be8a53de ("timekeeping: Fix bogus clock_was_set()
invocation in do_adjtimex()"), Thomas fixed a bug where instead
of passing one of the CLOCK_SET_* values to clock_was_set(),a
conceptually related clockid (CLOCK_REALTIME) was incorrectly
passed.
Just to make this type of accident less likely, lets rename the
base masks used by clock_was_set() to something that doesn't
resemble a clockid.
Thus:
CLOCK_SET_WALL -> BASEMASK_WALL_CLOCK_SET
CLOCK_SET_BOOT -> BASEMASK_BOOT_CLOCK_SET
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: John Stultz <jstultz@google.com>
---
kernel/time/hrtimer.c | 2 +-
kernel/time/tick-internal.h | 4 ++--
kernel/time/timekeeping.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index b8ee320208d41..ca18a2a344294 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -980,7 +980,7 @@ void clock_was_set(unsigned int bases)
static void clock_was_set_work(struct work_struct *work)
{
- clock_was_set(CLOCK_SET_WALL);
+ clock_was_set(BASEMASK_WALL_CLOCK_SET);
}
static DECLARE_WORK(hrtimer_work, clock_was_set_work);
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 5f2105e637bdf..59a6e50734f40 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -181,11 +181,11 @@ extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem);
u64 timer_base_try_to_set_idle(unsigned long basej, u64 basem, bool *idle);
void timer_clear_idle(void);
-#define CLOCK_SET_WALL \
+#define BASEMASK_WALL_CLOCK_SET \
(BIT(HRTIMER_BASE_REALTIME) | BIT(HRTIMER_BASE_REALTIME_SOFT) | \
BIT(HRTIMER_BASE_TAI) | BIT(HRTIMER_BASE_TAI_SOFT))
-#define CLOCK_SET_BOOT \
+#define BASEMASK_BOOT_CLOCK_SET \
(BIT(HRTIMER_BASE_BOOTTIME) | BIT(HRTIMER_BASE_BOOTTIME_SOFT))
void clock_was_set(unsigned int bases);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5391e4167d602..c8108345438aa 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1471,7 +1471,7 @@ int do_settimeofday64(const struct timespec64 *ts)
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
/* Signal hrtimers about time change */
- clock_was_set(CLOCK_SET_WALL);
+ clock_was_set(BASEMASK_WALL_CLOCK_SET);
if (!ret) {
audit_tk_injoffset(ts_delta);
@@ -1521,7 +1521,7 @@ static int timekeeping_inject_offset(const struct timespec64 *ts)
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
/* Signal hrtimers about time change */
- clock_was_set(CLOCK_SET_WALL);
+ clock_was_set(BASEMASK_WALL_CLOCK_SET);
return ret;
}
@@ -1896,7 +1896,7 @@ void timekeeping_inject_sleeptime64(const struct timespec64 *delta)
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
/* Signal hrtimers about time change */
- clock_was_set(CLOCK_SET_WALL | CLOCK_SET_BOOT);
+ clock_was_set(BASEMASK_WALL_CLOCK_SET | BASEMASK_BOOT_CLOCK_SET);
}
#endif
@@ -2606,7 +2606,7 @@ int do_adjtimex(struct __kernel_timex *txc)
clock_set |= timekeeping_advance(TK_ADV_FREQ);
if (clock_set)
- clock_was_set(CLOCK_SET_WALL);
+ clock_was_set(BASEMASK_WALL_CLOCK_SET);
ntp_notify_cmos_timer();
--
2.46.0.184.g6999bdac58-goog
next prev parent reply other threads:[~2024-08-15 20:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-03 15:07 [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex() Thomas Gleixner
2024-08-05 14:22 ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2024-08-05 17:50 ` [PATCH] " John Stultz
2024-08-05 18:30 ` Thomas Gleixner
2024-08-15 20:03 ` John Stultz [this message]
2024-09-02 15:45 ` [PATCH] time: Rename CLOCK_SET_* as BASEMASK_*_CLOCK_SET Thomas Gleixner
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=20240815200325.2474604-1-jstultz@google.com \
--to=jstultz@google.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
/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