Commit e3ac79e0 authored by Thomas Gleixner's avatar Thomas Gleixner

tick/broadcast: Move the check for periodic mode inside state handling

We need to check more than the periodic mode for proper operation in
all runtime combinations. To avoid code duplication move the check
into the enter state handling.

No functional change.

[ Split out from a larger combo patch ]
Reported-and-tested-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Suzuki Poulose <Suzuki.Poulose@arm.com>
Cc: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos
parent b78f3f3c
...@@ -688,7 +688,6 @@ static void broadcast_shutdown_local(struct clock_event_device *bc, ...@@ -688,7 +688,6 @@ static void broadcast_shutdown_local(struct clock_event_device *bc,
int __tick_broadcast_oneshot_control(enum tick_broadcast_state state) int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
{ {
struct clock_event_device *bc, *dev; struct clock_event_device *bc, *dev;
struct tick_device *td;
int cpu, ret = 0; int cpu, ret = 0;
ktime_t now; ktime_t now;
...@@ -699,25 +698,20 @@ int __tick_broadcast_oneshot_control(enum tick_broadcast_state state) ...@@ -699,25 +698,20 @@ int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
if (!tick_broadcast_device.evtdev) if (!tick_broadcast_device.evtdev)
return -EBUSY; return -EBUSY;
/* dev = this_cpu_ptr(&tick_cpu_device)->evtdev;
* Periodic mode does not care about the enter/exit of power
* states
*/
if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
return 0;
/*
* We are called with preemtion disabled from the depth of the
* idle code, so we can't be moved away.
*/
td = this_cpu_ptr(&tick_cpu_device);
dev = td->evtdev;
raw_spin_lock(&tick_broadcast_lock); raw_spin_lock(&tick_broadcast_lock);
bc = tick_broadcast_device.evtdev; bc = tick_broadcast_device.evtdev;
cpu = smp_processor_id(); cpu = smp_processor_id();
if (state == TICK_BROADCAST_ENTER) { if (state == TICK_BROADCAST_ENTER) {
/*
* If the broadcast device is in periodic mode, we
* return.
*/
if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
goto out;
if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) { if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) {
WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask)); WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask));
broadcast_shutdown_local(bc, dev); broadcast_shutdown_local(bc, dev);
......
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