@@ -329,27 +329,22 @@ unlock:
*/
static void tick_do_broadcast_on_off(unsigned long *reason)
{
- struct clock_event_device *bc, *dev;
- struct tick_device *td;
+ struct tick_device *td = tick_get_cpu_device();
+ struct clock_event_device *bc, *dev = td->evtdev;
+ int cpu = smp_processor_id(), bc_stopped;
unsigned long flags;
- int cpu, bc_stopped;
-
- raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
-
- cpu = smp_processor_id();
- td = tick_get_device(cpu);
- dev = td->evtdev;
- bc = tick_broadcast_device.evtdev;
/*
* Is the device not affected by the powerstate ?
*/
if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
- goto out;
+ return;
if (!tick_device_is_functional(dev))
- goto out;
+ return;
+ raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
+ bc = tick_broadcast_device.evtdev;
bc_stopped = cpumask_empty(tick_broadcast_mask);
switch (*reason) {
@@ -385,7 +380,6 @@ static void tick_do_broadcast_on_off(unsigned long *reason)
else
tick_broadcast_setup_oneshot(bc);
}
-out:
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
}
Some of the checks which may force tick_do_broadcast_on_off() to return early can be done before taking locks. This would make these codepaths faster. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- kernel/time/tick-broadcast.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)