[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210923153340.054751351@linutronix.de>
Date: Thu, 23 Sep 2021 18:04:37 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Subject: [patch 11/11] hrtimer: Make hrtimer_forward() private to core timer code
hrtimer_forward() invites to be used in the wrong way and there is no real
requirement to have it outside of the timers core code.
All users outside of the timer core code have been converted to
hrtimer_forward_now() which provides all what the non-core code usage
needs.
Export hrtimer_forward_now() instead and move the prototype to a timer core
header.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
include/linux/hrtimer.h | 26 +-------------------------
kernel/time/hrtimer.c | 23 ++++++++++++++++++++++-
kernel/time/posix-timers.c | 1 +
kernel/time/tick-internal.h | 1 +
4 files changed, 25 insertions(+), 26 deletions(-)
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -480,31 +480,7 @@ static inline int hrtimer_callback_runni
return timer->base->running == timer;
}
-/* Forward a hrtimer so it expires after now: */
-extern u64
-hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
-
-/**
- * hrtimer_forward_now - forward the timer expiry so it expires after now
- * @timer: hrtimer to forward
- * @interval: the interval to forward
- *
- * Forward the timer expiry so it will expire after the current time
- * of the hrtimer clock base. Returns the number of overruns.
- *
- * Can be safely called from the callback function of @timer. If
- * called from other contexts @timer must neither be enqueued nor
- * running the callback and the caller needs to take care of
- * serialization.
- *
- * Note: This only updates the timer expiry value and does not requeue
- * the timer.
- */
-static inline u64 hrtimer_forward_now(struct hrtimer *timer,
- ktime_t interval)
-{
- return hrtimer_forward(timer, timer->base->get_time(), interval);
-}
+extern u64 hrtimer_forward_now(struct hrtimer *timer, ktime_t interval);
/* Precise sleep: */
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1067,7 +1067,28 @@ u64 hrtimer_forward(struct hrtimer *time
return orun;
}
-EXPORT_SYMBOL_GPL(hrtimer_forward);
+
+/**
+ * hrtimer_forward_now - forward the timer expiry so it expires after now
+ * @timer: hrtimer to forward
+ * @interval: the interval to forward
+ *
+ * Forward the timer expiry so it will expire after the current time
+ * of the hrtimer clock base. Returns the number of overruns.
+ *
+ * Can be safely called from the callback function of @timer. If
+ * called from other contexts @timer must neither be enqueued nor
+ * running the callback and the caller needs to take care of
+ * serialization.
+ *
+ * Note: This only updates the timer expiry value and does not requeue
+ * the timer.
+ */
+extern u64 hrtimer_forward_now(struct hrtimer *timer, ktime_t interval)
+{
+ return hrtimer_forward(timer, timer->base->get_time(), interval);
+}
+EXPORT_SYMBOL_GPL(hrtimer_forward_now);
/*
* enqueue_hrtimer - internal function to (re)start a timer
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -33,6 +33,7 @@
#include <linux/time_namespace.h>
#include "timekeeping.h"
+#include "tick-internal.h"
#include "posix-timers.h"
/*
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -177,6 +177,7 @@ void clock_was_set(unsigned int bases);
void clock_was_set_delayed(void);
void hrtimers_resume_local(void);
+u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
/* Since jiffies uses a simple TICK_NSEC multiplier
* conversion, the .shift value could be zero. However
Powered by blists - more mailing lists