Commit 051ebd10 authored by Thomas Gleixner's avatar Thomas Gleixner

clockevents: Use set/get state helper functions

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
parent d7eb231c
...@@ -137,7 +137,8 @@ static int __clockevents_switch_state(struct clock_event_device *dev, ...@@ -137,7 +137,8 @@ static int __clockevents_switch_state(struct clock_event_device *dev,
case CLOCK_EVT_STATE_ONESHOT_STOPPED: case CLOCK_EVT_STATE_ONESHOT_STOPPED:
/* Core internal bug */ /* Core internal bug */
if (WARN_ONCE(!clockevent_state_oneshot(dev), if (WARN_ONCE(!clockevent_state_oneshot(dev),
"Current state: %d\n", dev->state)) "Current state: %d\n",
clockevent_get_state(dev)))
return -EINVAL; return -EINVAL;
if (dev->set_state_oneshot_stopped) if (dev->set_state_oneshot_stopped)
...@@ -160,11 +161,11 @@ static int __clockevents_switch_state(struct clock_event_device *dev, ...@@ -160,11 +161,11 @@ static int __clockevents_switch_state(struct clock_event_device *dev,
void clockevents_switch_state(struct clock_event_device *dev, void clockevents_switch_state(struct clock_event_device *dev,
enum clock_event_state state) enum clock_event_state state)
{ {
if (dev->state != state) { if (clockevent_get_state(dev) != state) {
if (__clockevents_switch_state(dev, state)) if (__clockevents_switch_state(dev, state))
return; return;
dev->state = state; clockevent_set_state(dev, state);
/* /*
* A nsec2cyc multiplicator of 0 is invalid and we'd crash * 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,7 +334,7 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
/* We must be in ONESHOT state here */ /* We must be in ONESHOT state here */
WARN_ONCE(!clockevent_state_oneshot(dev), "Current state: %d\n", WARN_ONCE(!clockevent_state_oneshot(dev), "Current state: %d\n",
dev->state); clockevent_get_state(dev));
/* Shortcut for clockevent devices that can deal with ktime. */ /* Shortcut for clockevent devices that can deal with ktime. */
if (dev->features & CLOCK_EVT_FEAT_KTIME) if (dev->features & CLOCK_EVT_FEAT_KTIME)
...@@ -496,7 +497,7 @@ void clockevents_register_device(struct clock_event_device *dev) ...@@ -496,7 +497,7 @@ void clockevents_register_device(struct clock_event_device *dev)
BUG_ON(clockevents_sanity_check(dev)); BUG_ON(clockevents_sanity_check(dev));
/* Initialize state to DETACHED */ /* Initialize state to DETACHED */
dev->state = CLOCK_EVT_STATE_DETACHED; clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED);
if (!dev->cpumask) { if (!dev->cpumask) {
WARN_ON(num_possible_cpus() > 1); WARN_ON(num_possible_cpus() > 1);
......
...@@ -377,7 +377,7 @@ void tick_shutdown(unsigned int cpu) ...@@ -377,7 +377,7 @@ void tick_shutdown(unsigned int cpu)
* Prevent that the clock events layer tries to call * Prevent that the clock events layer tries to call
* the set mode function! * the set mode function!
*/ */
dev->state = CLOCK_EVT_STATE_DETACHED; clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED);
dev->mode = CLOCK_EVT_MODE_UNUSED; dev->mode = CLOCK_EVT_MODE_UNUSED;
clockevents_exchange_device(dev, NULL); clockevents_exchange_device(dev, NULL);
dev->event_handler = clockevents_handle_noop; dev->event_handler = clockevents_handle_noop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment