kernel: broadcast-hrtimer: Migrate to new 'set-state' interface
Migrate broadcast-hrtimer driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
8e40fc4b78
commit
ecbebcb868
@ -18,30 +18,23 @@
|
|||||||
|
|
||||||
static struct hrtimer bctimer;
|
static struct hrtimer bctimer;
|
||||||
|
|
||||||
static void bc_set_mode(enum clock_event_mode mode,
|
static int bc_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *bc)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
/*
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
* Note, we cannot cancel the timer here as we might
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
* run into the following live lock scenario:
|
||||||
/*
|
*
|
||||||
* Note, we cannot cancel the timer here as we might
|
* cpu 0 cpu1
|
||||||
* run into the following live lock scenario:
|
* lock(broadcast_lock);
|
||||||
*
|
* hrtimer_interrupt()
|
||||||
* cpu 0 cpu1
|
* bc_handler()
|
||||||
* lock(broadcast_lock);
|
* tick_handle_oneshot_broadcast();
|
||||||
* hrtimer_interrupt()
|
* lock(broadcast_lock);
|
||||||
* bc_handler()
|
* hrtimer_cancel()
|
||||||
* tick_handle_oneshot_broadcast();
|
* wait_for_callback()
|
||||||
* lock(broadcast_lock);
|
*/
|
||||||
* hrtimer_cancel()
|
hrtimer_try_to_cancel(&bctimer);
|
||||||
* wait_for_callback()
|
return 0;
|
||||||
*/
|
|
||||||
hrtimer_try_to_cancel(&bctimer);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -82,7 +75,7 @@ static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device ce_broadcast_hrtimer = {
|
static struct clock_event_device ce_broadcast_hrtimer = {
|
||||||
.set_mode = bc_set_mode,
|
.set_state_shutdown = bc_shutdown,
|
||||||
.set_next_ktime = bc_set_next,
|
.set_next_ktime = bc_set_next,
|
||||||
.features = CLOCK_EVT_FEAT_ONESHOT |
|
.features = CLOCK_EVT_FEAT_ONESHOT |
|
||||||
CLOCK_EVT_FEAT_KTIME |
|
CLOCK_EVT_FEAT_KTIME |
|
||||||
@ -102,13 +95,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)
|
|||||||
{
|
{
|
||||||
ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer);
|
ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer);
|
||||||
|
|
||||||
switch (ce_broadcast_hrtimer.mode) {
|
if (clockevent_state_oneshot(&ce_broadcast_hrtimer))
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
if (ce_broadcast_hrtimer.next_event.tv64 != KTIME_MAX)
|
if (ce_broadcast_hrtimer.next_event.tv64 != KTIME_MAX)
|
||||||
return HRTIMER_RESTART;
|
return HRTIMER_RESTART;
|
||||||
default:
|
|
||||||
return HRTIMER_NORESTART;
|
return HRTIMER_NORESTART;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tick_setup_hrtimer_broadcast(void)
|
void tick_setup_hrtimer_broadcast(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user