From: tip-bot for Viresh Kumar <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, viresh.kumar@linaro.org,
linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@kernel.org, tglx@linutronix.de
Subject: [tip:timers/core] clockevents: Add helpers to check the state of a clockevent device
Date: Tue, 2 Jun 2015 12:30:52 -0700 [thread overview]
Message-ID: <tip-3434d23b694e5cb6e44e966914563406c31c4053@git.kernel.org> (raw)
In-Reply-To: <04a717d490335c688dd7af899fbcede97e1bb8ee.1432192527.git.viresh.kumar@linaro.org>
Commit-ID: 3434d23b694e5cb6e44e966914563406c31c4053
Gitweb: http://git.kernel.org/tip/3434d23b694e5cb6e44e966914563406c31c4053
Author: Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu, 21 May 2015 13:33:45 +0530
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 2 Jun 2015 14:40:47 +0200
clockevents: Add helpers to check the state of a clockevent device
Some clockevent drivers, once migrated to use per-state callbacks,
need to check the state of the clockevent device in their callbacks or
interrupt handler.
Add accessor functions clockevent_state_*() to get this information.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/04a717d490335c688dd7af899fbcede97e1bb8ee.1432192527.git.viresh.kumar@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/clockchips.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 271fa4c..64214ad 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -149,6 +149,32 @@ struct clock_event_device {
struct module *owner;
} ____cacheline_aligned;
+/* Helpers to verify state of a clockevent device */
+static inline bool clockevent_state_detached(struct clock_event_device *dev)
+{
+ return dev->state == CLOCK_EVT_STATE_DETACHED;
+}
+
+static inline bool clockevent_state_shutdown(struct clock_event_device *dev)
+{
+ return dev->state == CLOCK_EVT_STATE_SHUTDOWN;
+}
+
+static inline bool clockevent_state_periodic(struct clock_event_device *dev)
+{
+ return dev->state == CLOCK_EVT_STATE_PERIODIC;
+}
+
+static inline bool clockevent_state_oneshot(struct clock_event_device *dev)
+{
+ return dev->state == CLOCK_EVT_STATE_ONESHOT;
+}
+
+static inline bool clockevent_state_oneshot_stopped(struct clock_event_device *dev)
+{
+ return dev->state == CLOCK_EVT_STATE_ONESHOT_STOPPED;
+}
+
/*
* Calculate a multiplication factor for scaled math, which is used to convert
* nanoseconds based values to clock ticks:
next prev parent reply other threads:[~2015-06-02 19:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 8:03 [PATCH V2 0/2] clockevents: Add helpers to verify " Viresh Kumar
2015-05-21 8:03 ` [PATCH V2 1/2] " Viresh Kumar
2015-06-02 19:30 ` tip-bot for Viresh Kumar [this message]
2015-05-21 8:03 ` [PATCH V2 2/2] clockevents: Use " Viresh Kumar
2015-06-02 19:31 ` [tip:timers/core] clockevents: Use helpers to check the " tip-bot for Viresh Kumar
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=tip-3434d23b694e5cb6e44e966914563406c31c4053@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.org \
/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
Powered by JetHome