diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-06-02 08:13:46 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-06-02 08:40:48 -0400 |
commit | 051ebd101b05c09d9b5b673e19fb0586e9bfec56 (patch) | |
tree | f34db44cf8e21fe870fc494eedc73ca09861f2f5 | |
parent | d7eb231c71420bc34ac3d35403115600f920cfc2 (diff) |
clockevents: Use set/get state helper functions
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
-rw-r--r-- | kernel/time/clockevents.c | 11 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index a45f90c4b2d5..2397b97320d8 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -137,7 +137,8 @@ static int __clockevents_switch_state(struct clock_event_device *dev, | |||
137 | case CLOCK_EVT_STATE_ONESHOT_STOPPED: | 137 | case CLOCK_EVT_STATE_ONESHOT_STOPPED: |
138 | /* Core internal bug */ | 138 | /* Core internal bug */ |
139 | if (WARN_ONCE(!clockevent_state_oneshot(dev), | 139 | if (WARN_ONCE(!clockevent_state_oneshot(dev), |
140 | "Current state: %d\n", dev->state)) | 140 | "Current state: %d\n", |
141 | clockevent_get_state(dev))) | ||
141 | return -EINVAL; | 142 | return -EINVAL; |
142 | 143 | ||
143 | if (dev->set_state_oneshot_stopped) | 144 | if (dev->set_state_oneshot_stopped) |
@@ -160,11 +161,11 @@ static int __clockevents_switch_state(struct clock_event_device *dev, | |||
160 | void clockevents_switch_state(struct clock_event_device *dev, | 161 | void clockevents_switch_state(struct clock_event_device *dev, |
161 | enum clock_event_state state) | 162 | enum clock_event_state state) |
162 | { | 163 | { |
163 | if (dev->state != state) { | 164 | if (clockevent_get_state(dev) != state) { |
164 | if (__clockevents_switch_state(dev, state)) | 165 | if (__clockevents_switch_state(dev, state)) |
165 | return; | 166 | return; |
166 | 167 | ||
167 | dev->state = state; | 168 | clockevent_set_state(dev, state); |
168 | 169 | ||
169 | /* | 170 | /* |
170 | * A nsec2cyc multiplicator of 0 is invalid and we'd crash | 171 | * A nsec2cyc multiplicator of 0 is invalid and we'd crash |
@@ -333,7 +334,7 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, | |||
333 | 334 | ||
334 | /* We must be in ONESHOT state here */ | 335 | /* We must be in ONESHOT state here */ |
335 | WARN_ONCE(!clockevent_state_oneshot(dev), "Current state: %d\n", | 336 | WARN_ONCE(!clockevent_state_oneshot(dev), "Current state: %d\n", |
336 | dev->state); | 337 | clockevent_get_state(dev)); |
337 | 338 | ||
338 | /* Shortcut for clockevent devices that can deal with ktime. */ | 339 | /* Shortcut for clockevent devices that can deal with ktime. */ |
339 | if (dev->features & CLOCK_EVT_FEAT_KTIME) | 340 | if (dev->features & CLOCK_EVT_FEAT_KTIME) |
@@ -496,7 +497,7 @@ void clockevents_register_device(struct clock_event_device *dev) | |||
496 | BUG_ON(clockevents_sanity_check(dev)); | 497 | BUG_ON(clockevents_sanity_check(dev)); |
497 | 498 | ||
498 | /* Initialize state to DETACHED */ | 499 | /* Initialize state to DETACHED */ |
499 | dev->state = CLOCK_EVT_STATE_DETACHED; | 500 | clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED); |
500 | 501 | ||
501 | if (!dev->cpumask) { | 502 | if (!dev->cpumask) { |
502 | WARN_ON(num_possible_cpus() > 1); | 503 | WARN_ON(num_possible_cpus() > 1); |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 311e2e133517..17f144450050 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -377,7 +377,7 @@ void tick_shutdown(unsigned int cpu) | |||
377 | * Prevent that the clock events layer tries to call | 377 | * Prevent that the clock events layer tries to call |
378 | * the set mode function! | 378 | * the set mode function! |
379 | */ | 379 | */ |
380 | dev->state = CLOCK_EVT_STATE_DETACHED; | 380 | clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED); |
381 | dev->mode = CLOCK_EVT_MODE_UNUSED; | 381 | dev->mode = CLOCK_EVT_MODE_UNUSED; |
382 | clockevents_exchange_device(dev, NULL); | 382 | clockevents_exchange_device(dev, NULL); |
383 | dev->event_handler = clockevents_handle_noop; | 383 | dev->event_handler = clockevents_handle_noop; |