struct power_mode *mode;
int pos;
+ spin_lock(&cpupm_lock);
pm = &per_cpu(cpupm, cpu);
for_each_mode(mode, pm->modes, pos) {
* The first mode disable request wakes the cpus to
* exit power mode
*/
- if (atomic_inc_return(&mode->disable) == 1)
+ if (atomic_inc_return(&mode->disable) == 1) {
+ spin_unlock(&cpupm_lock);
awake_cpus(&mode->siblings);
+ return;
+ }
}
}
+ spin_unlock(&cpupm_lock);
}
void enable_power_mode(int cpu, int type)
struct power_mode *mode;
int pos;
+ spin_lock(&cpupm_lock);
pm = &per_cpu(cpupm, cpu);
for_each_mode(mode, pm->modes, pos) {
if (mode->type == type)
atomic_dec(&mode->disable);
}
+ spin_unlock(&cpupm_lock);
}
/* get sleep length of given cpu from tickless framework */