aboutsummaryrefslogtreecommitdiff
path: root/kernel/time/clockevents.c
diff options
context:
space:
mode:
authorViresh Kumar2015-02-27 17:21:32 +0530
committerIngo Molnar2015-03-27 10:26:19 +0100
commit554ef3876c6acdff1331feab10275e9e9e0adb84 (patch)
treee01d4c83d5f177e814e5cd749206ef9801081b2b /kernel/time/clockevents.c
parentfe5fba05b46c791c95a9f34228ac495f81f72fc0 (diff)
clockevents: Handle tick device's resume separately
Upcoming patch will redefine possible states of a clockevent device. The RESUME mode is a special case only for tick's clockevent devices. In future it can be replaced by ->resume() callback already available for clockevent devices. Lets handle it separately so that clockevents_set_mode() only handles states valid across all devices. This also renames set_mode_resume() to tick_resume() to make it more explicit. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Kevin Hilman <khilman@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: linaro-kernel@lists.linaro.org Cc: linaro-networking@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/c1b0112410870f49e7bf06958e1483eac6c15e20.1425037853.git.viresh.kumar@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time/clockevents.c')
-rw-r--r--kernel/time/clockevents.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 489642b08d64..1b0ea63de69c 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -100,7 +100,7 @@ static int __clockevents_set_mode(struct clock_event_device *dev,
/* Transition with legacy set_mode() callback */
if (dev->set_mode) {
/* Legacy callback doesn't support new modes */
- if (mode > CLOCK_EVT_MODE_RESUME)
+ if (mode > CLOCK_EVT_MODE_ONESHOT)
return -ENOSYS;
dev->set_mode(mode, dev);
return 0;
@@ -133,13 +133,6 @@ static int __clockevents_set_mode(struct clock_event_device *dev,
return -ENOSYS;
return dev->set_mode_oneshot(dev);
- case CLOCK_EVT_MODE_RESUME:
- /* Optional callback */
- if (dev->set_mode_resume)
- return dev->set_mode_resume(dev);
- else
- return 0;
-
default:
return -ENOSYS;
}
@@ -184,6 +177,25 @@ void clockevents_shutdown(struct clock_event_device *dev)
dev->next_event.tv64 = KTIME_MAX;
}
+/**
+ * clockevents_tick_resume - Resume the tick device before using it again
+ * @dev: device to resume
+ */
+int clockevents_tick_resume(struct clock_event_device *dev)
+{
+ int ret = 0;
+
+ if (dev->set_mode)
+ dev->set_mode(CLOCK_EVT_MODE_RESUME, dev);
+ else if (dev->tick_resume)
+ ret = dev->tick_resume(dev);
+
+ if (likely(!ret))
+ dev->mode = CLOCK_EVT_MODE_RESUME;
+
+ return ret;
+}
+
#ifdef CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST
/* Limit min_delta to a jiffie */
@@ -433,7 +445,7 @@ static int clockevents_sanity_check(struct clock_event_device *dev)
if (dev->set_mode) {
/* We shouldn't be supporting new modes now */
WARN_ON(dev->set_mode_periodic || dev->set_mode_oneshot ||
- dev->set_mode_shutdown || dev->set_mode_resume);
+ dev->set_mode_shutdown || dev->tick_resume);
return 0;
}