Skip to content

Commit 9b89571

Browse files
andy-shevopsiff
authored andcommitted
hrtimers: Mark is_migration_base() with __always_inline
[ Upstream commit 27af31e ] When is_migration_base() is unused, it prevents kernel builds with clang, `make W=1` and CONFIG_WERROR=y: kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function] 156 | static inline bool is_migration_base(struct hrtimer_clock_base *base) | ^~~~~~~~~~~~~~~~~ Fix this by marking it with __always_inline. [ tglx: Use __always_inline instead of __maybe_unused and move it into the usage sites conditional ] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250116160745.243358-1-andriy.shevchenko@linux.intel.com Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit a625ad9)
1 parent c655278 commit 9b89571

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

kernel/time/hrtimer.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ static struct hrtimer_cpu_base migration_cpu_base = {
145145

146146
#define migration_base migration_cpu_base.clock_base[0]
147147

148-
static inline bool is_migration_base(struct hrtimer_clock_base *base)
149-
{
150-
return base == &migration_base;
151-
}
152-
153148
/*
154149
* We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock
155150
* means that all timers which are tied to this base via timer->base are
@@ -275,11 +270,6 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,
275270

276271
#else /* CONFIG_SMP */
277272

278-
static inline bool is_migration_base(struct hrtimer_clock_base *base)
279-
{
280-
return false;
281-
}
282-
283273
static inline struct hrtimer_clock_base *
284274
lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
285275
__acquires(&timer->base->cpu_base->lock)
@@ -1381,6 +1371,18 @@ static void hrtimer_sync_wait_running(struct hrtimer_cpu_base *cpu_base,
13811371
}
13821372
}
13831373

1374+
#ifdef CONFIG_SMP
1375+
static __always_inline bool is_migration_base(struct hrtimer_clock_base *base)
1376+
{
1377+
return base == &migration_base;
1378+
}
1379+
#else
1380+
static __always_inline bool is_migration_base(struct hrtimer_clock_base *base)
1381+
{
1382+
return false;
1383+
}
1384+
#endif
1385+
13841386
/*
13851387
* This function is called on PREEMPT_RT kernels when the fast path
13861388
* deletion of a timer failed because the timer callback function was

0 commit comments

Comments
 (0)