Skip to content

Commit

Permalink
clockevents: Use set/get state helper functions
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
  • Loading branch information
KAGA-KOKO committed Jun 2, 2015
1 parent d7eb231 commit 051ebd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions kernel/time/clockevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ static int __clockevents_switch_state(struct clock_event_device *dev,
case CLOCK_EVT_STATE_ONESHOT_STOPPED:
/* Core internal bug */
if (WARN_ONCE(!clockevent_state_oneshot(dev),
"Current state: %d\n", dev->state))
"Current state: %d\n",
clockevent_get_state(dev)))
return -EINVAL;

if (dev->set_state_oneshot_stopped)
Expand All @@ -160,11 +161,11 @@ static int __clockevents_switch_state(struct clock_event_device *dev,
void clockevents_switch_state(struct clock_event_device *dev,
enum clock_event_state state)
{
if (dev->state != state) {
if (clockevent_get_state(dev) != state) {
if (__clockevents_switch_state(dev, state))
return;

dev->state = state;
clockevent_set_state(dev, state);

/*
* A nsec2cyc multiplicator of 0 is invalid and we'd crash
Expand Down Expand Up @@ -333,7 +334,7 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,

/* We must be in ONESHOT state here */
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. */
if (dev->features & CLOCK_EVT_FEAT_KTIME)
Expand Down Expand Up @@ -496,7 +497,7 @@ void clockevents_register_device(struct clock_event_device *dev)
BUG_ON(clockevents_sanity_check(dev));

/* Initialize state to DETACHED */
dev->state = CLOCK_EVT_STATE_DETACHED;
clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED);

if (!dev->cpumask) {
WARN_ON(num_possible_cpus() > 1);
Expand Down
2 changes: 1 addition & 1 deletion kernel/time/tick-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void tick_shutdown(unsigned int cpu)
* Prevent that the clock events layer tries to call
* the set mode function!
*/
dev->state = CLOCK_EVT_STATE_DETACHED;
clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED);
dev->mode = CLOCK_EVT_MODE_UNUSED;
clockevents_exchange_device(dev, NULL);
dev->event_handler = clockevents_handle_noop;
Expand Down

0 comments on commit 051ebd1

Please sign in to comment.