aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clockchips.h
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-05-21 13:33:45 +0530
committerThomas Gleixner <tglx@linutronix.de>2015-06-02 14:40:47 +0200
commit3434d23b694e5cb6e44e966914563406c31c4053 (patch)
treee382aa8d0a8603cc708650bc00336975632e220b /include/linux/clockchips.h
parentclockevents: Do not suspend/resume if unused (diff)
downloadlinux-dev-3434d23b694e5cb6e44e966914563406c31c4053.tar.xz
linux-dev-3434d23b694e5cb6e44e966914563406c31c4053.zip
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>
Diffstat (limited to 'include/linux/clockchips.h')
-rw-r--r--include/linux/clockchips.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 271fa4c8eb29..64214ad85af9 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: