From: Olliver Schinagl <o.schinagl@ultimaker.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Olliver Schinagl <oliver@schinagl.nl>
Subject: [PATCH] hrtimer: add hrtimer_start_now()
Date: Thu, 22 Jan 2015 07:12:41 +0100 [thread overview]
Message-ID: <1421907161-5744-1-git-send-email-o.schinagl@ultimaker.com> (raw)
From: Olliver Schinagl <oliver@schinagl.nl>
When using a hrtimer for repeating periodic ticks, hrtimer_forward_now()
is often used. Quite possibly the timer loop is thus probably fully
controlled by hrtimer_forward_now() and we don't really care when the
timer is started. With hrtimer_start() we need to define exactly when a
event has to start. By introducing hrtimer_start_now() we do the same as
what hrtimer_forward_now() does, start as soon as possible and get into
the timer loop.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
include/linux/hrtimer.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index a036d05..080a5f5 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -353,6 +353,12 @@ static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
/* Basic timer operations: */
extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
const enum hrtimer_mode mode);
+
+static inline int hrtimer_start_now(struct hrtimer *timer,
+ const enum hrtimer_mode mode)
+{
+ return hrtimer_start(timer, timer->base->get_time(), mode);
+}
extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
unsigned long range_ns, const enum hrtimer_mode mode);
extern int
--
2.1.4
next reply other threads:[~2015-01-22 7:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 6:12 Olliver Schinagl [this message]
2015-01-22 11:01 ` Thomas Gleixner
2015-01-22 11:07 ` Olliver Schinagl
2015-01-22 19:35 ` 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=1421907161-5744-1-git-send-email-o.schinagl@ultimaker.com \
--to=o.schinagl@ultimaker.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver@schinagl.nl \
--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
all inboxes | Powered by JetHome®