Skip to contentSkip to conversation

timers: Remove dead code in hrtimer and clocksource

PATCH Applied Zhan Xusheng 2 participants 5 messages Jul 6

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover timers: Remove dead code in hrtimer and clocksource

Two small dead-code removals in kernel/time, found while auditing for unused function arguments and macros:

1/2 hrtimer: __hrtimer_reprogram() has a @next_timer argument that is
never used; the function only stores @expires_next and reprograms the clock event device. Unused since commit b14bca97c9f5 ("hrtimer: Consolidate reprogramming code").
2/2 clocksource: WATCHDOG_INTERVAL_NS has been unused since it was
added in commit 763aacf86f1b ("clocksource: Rewrite watchdog code completely").

No functional change in either patch.

Zhan Xusheng (2):
hrtimer: Remove unused next_timer argument from __hrtimer_reprogram()
clocksource: Remove unused WATCHDOG_INTERVAL_NS macro

 kernel/time/clocksource.c | 1 -
 kernel/time/hrtimer.c     | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 hrtimer: Remove unused next_timer argument from __hrtimer_reprogram()

__hrtimer_reprogram() takes a @next_timer argument but never references it; it only stores @expires_next into cpu_base->expires_next and reprograms the clock event device. The argument has been unused since commit b14bca97c9f5 ("hrtimer: Consolidate reprogramming code").

Drop it and update the two callers. No functional change.

---
 kernel/time/hrtimer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/time/hrtimer.c +3 -3
index 313dcea127fe..905a91a93bc5 100644
@@ -707,7 +707,7 @@ static inline void hrtimer_rearm_event(ktime_t expires_next, bool deferred)
 	tick_program_event(expires_next, 1);
 }
 
-static void __hrtimer_reprogram(struct hrtimer_cpu_base *cpu_base, struct hrtimer *next_timer,
+static void __hrtimer_reprogram(struct hrtimer_cpu_base *cpu_base,
 				ktime_t expires_next)
 {
 	cpu_base->expires_next = expires_next;
@@ -743,7 +743,7 @@ static void hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, bool skip
 	if (skip_equal && expires_next == cpu_base->expires_next)
 		return;
 
-	__hrtimer_reprogram(cpu_base, cpu_base->next_timer, expires_next);
+	__hrtimer_reprogram(cpu_base, expires_next);
 }
 
 /* High resolution timer related functions */
@@ -896,7 +896,7 @@ static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram)
 
 	cpu_base->next_timer = timer;
 
-	__hrtimer_reprogram(cpu_base, timer, expires);
+	__hrtimer_reprogram(cpu_base, expires);
 }
 
 static bool update_needs_ipi(struct hrtimer_cpu_base *cpu_base, unsigned int active)
Signature · 1 line
2.43.0
merge bot Applied
#2 lore raw

[tip: timers/core] hrtimer: Remove unused next_timer argument from __hrtimer_reprogram()

The following commit has been merged into the timers/core branch of tip:

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     d8966ca88566d94de9958a84f93bd08bfc431ee6
Gitweb:        https://git.kernel.org/tip/d8966ca88566d94de9958a84f93bd08bfc431ee6
Author:        Zhan Xusheng <[email protected]>
AuthorDate:    Mon, 06 Jul 2026 16:45:56 +08:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 06 Jul 2026 17:51:36 +02:00

hrtimer: Remove unused next_timer argument from __hrtimer_reprogram()

__hrtimer_reprogram() takes a @next_timer argument but never references it; it only stores @expires_next into cpu_base->expires_next and reprograms the clock event device. The argument has been unused since commit b14bca97c9f5 ("hrtimer: Consolidate reprogramming code").

Drop it and update the two callers. No functional change.

---
 kernel/time/hrtimer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/time/hrtimer.c +3 -3
index 2a278ae..9c320ab 100644
@@ -707,7 +707,7 @@ static inline void hrtimer_rearm_event(ktime_t expires_next, bool deferred)
 	tick_program_event(expires_next, 1);
 }
 
-static void __hrtimer_reprogram(struct hrtimer_cpu_base *cpu_base, struct hrtimer *next_timer,
+static void __hrtimer_reprogram(struct hrtimer_cpu_base *cpu_base,
 				ktime_t expires_next)
 {
 	cpu_base->expires_next = expires_next;
@@ -743,7 +743,7 @@ static void hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, bool skip
 	if (skip_equal && expires_next == cpu_base->expires_next)
 		return;
 
-	__hrtimer_reprogram(cpu_base, cpu_base->next_timer, expires_next);
+	__hrtimer_reprogram(cpu_base, expires_next);
 }
 
 /* High resolution timer related functions */
@@ -896,7 +896,7 @@ static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram)
 
 	cpu_base->next_timer = timer;
 
-	__hrtimer_reprogram(cpu_base, timer, expires);
+	__hrtimer_reprogram(cpu_base, expires);
 }
 
 static bool update_needs_ipi(struct hrtimer_cpu_base *cpu_base, unsigned int active)
#3 lore raw

PATCH 2/2 clocksource: Remove unused WATCHDOG_INTERVAL_NS macro

In reply to Zhan Xusheng

WATCHDOG_INTERVAL_NS has been unused since it was introduced by commit 763aacf86f1b ("clocksource: Rewrite watchdog code completely"); the watchdog timer rearming uses WATCHDOG_INTERVAL (in jiffies) directly and the nanosecond variant has never had a user.

Remove the dead macro. No functional change.

---
 kernel/time/clocksource.c | 1 -
 1 file changed, 1 deletion(-)
kernel/time/clocksource.c +0 -1
index e48c4d379a7c..78c91b0037f7 100644
@@ -123,7 +123,6 @@ static atomic_t watchdog_reset_pending;
 
 /* Watchdog interval: 0.5sec. */
 #define WATCHDOG_INTERVAL		(HZ >> 1)
-#define WATCHDOG_INTERVAL_NS		(WATCHDOG_INTERVAL * (NSEC_PER_SEC / HZ))
 
 /* Maximum time between two reference watchdog readouts */
 #define WATCHDOG_READOUT_MAX_NS		(50U * NSEC_PER_USEC)
Signature · 1 line
2.43.0
merge bot Applied
#4 lore raw

[tip: timers/core] clocksource: Remove unused WATCHDOG_INTERVAL_NS macro

The following commit has been merged into the timers/core branch of tip:

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     b3afded935a8528d3df57198aaa90651995622c5
Gitweb:        https://git.kernel.org/tip/b3afded935a8528d3df57198aaa90651995622c5
Author:        Zhan Xusheng <[email protected]>
AuthorDate:    Mon, 06 Jul 2026 16:45:57 +08:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 06 Jul 2026 17:51:36 +02:00

clocksource: Remove unused WATCHDOG_INTERVAL_NS macro

WATCHDOG_INTERVAL_NS has been unused since it was introduced by commit 763aacf86f1b ("clocksource: Rewrite watchdog code completely"); the watchdog timer rearming uses WATCHDOG_INTERVAL (in jiffies) directly and the nanosecond variant has never had a user.

Remove the dead macro. No functional change.

---
 kernel/time/clocksource.c | 1 -
 1 file changed, 1 deletion(-)
kernel/time/clocksource.c +0 -1
index e48c4d3..78c91b0 100644
@@ -123,7 +123,6 @@ static atomic_t watchdog_reset_pending;
 
 /* Watchdog interval: 0.5sec. */
 #define WATCHDOG_INTERVAL		(HZ >> 1)
-#define WATCHDOG_INTERVAL_NS		(WATCHDOG_INTERVAL * (NSEC_PER_SEC / HZ))
 
 /* Maximum time between two reference watchdog readouts */
 #define WATCHDOG_READOUT_MAX_NS		(50U * NSEC_PER_USEC)