Skip to content

Commit b9f659b

Browse files
committed
Merge tag 'pm-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix two bugs in error code paths in the PM core (system-wide suspend of devices), a device reference leak in the boot-time suspend test code and a cpupower utility regression from the 4.7 cycle. Specifics: - Prevent the PM core from attempting to suspend parent devices if any of their children, whose suspend callbacks were invoked asynchronously, have failed to suspend during the "late" and "noirq" phases of system-wide suspend of devices (Brian Norris). - Prevent the boot-time system suspend test code from leaking a reference to the RTC device used by it (Johan Hovold). - Fix cpupower to use the return value of one of its library functions correctly and restore the correct behavior of it when used for setting cpufreq tunables broken during the 4.7 development cycle (Laura Abbott)" * tag 'pm-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails PM / sleep: fix device reference leak in test_suspend cpupower: Correct return type of cpu_power_is_cpu_online() in cpufreq-set
2 parents e6251f0 + cd16f3d commit b9f659b

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

drivers/base/power/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,8 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
10271027
TRACE_DEVICE(dev);
10281028
TRACE_SUSPEND(0);
10291029

1030+
dpm_wait_for_children(dev, async);
1031+
10301032
if (async_error)
10311033
goto Complete;
10321034

@@ -1038,8 +1040,6 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
10381040
if (dev->power.syscore || dev->power.direct_complete)
10391041
goto Complete;
10401042

1041-
dpm_wait_for_children(dev, async);
1042-
10431043
if (dev->pm_domain) {
10441044
info = "noirq power domain ";
10451045
callback = pm_noirq_op(&dev->pm_domain->ops, state);
@@ -1174,6 +1174,8 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
11741174

11751175
__pm_runtime_disable(dev, false);
11761176

1177+
dpm_wait_for_children(dev, async);
1178+
11771179
if (async_error)
11781180
goto Complete;
11791181

@@ -1185,8 +1187,6 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
11851187
if (dev->power.syscore || dev->power.direct_complete)
11861188
goto Complete;
11871189

1188-
dpm_wait_for_children(dev, async);
1189-
11901190
if (dev->pm_domain) {
11911191
info = "late power domain ";
11921192
callback = pm_late_early_op(&dev->pm_domain->ops, state);

kernel/power/suspend_test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ static int __init test_suspend(void)
203203

204204
/* RTCs have initialized by now too ... can we use one? */
205205
dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm);
206-
if (dev)
206+
if (dev) {
207207
rtc = rtc_class_open(dev_name(dev));
208+
put_device(dev);
209+
}
208210
if (!rtc) {
209211
printk(warn_no_rtc);
210212
return 0;

tools/power/cpupower/utils/cpufreq-set.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
296296
struct cpufreq_affected_cpus *cpus;
297297

298298
if (!bitmask_isbitset(cpus_chosen, cpu) ||
299-
cpupower_is_cpu_online(cpu))
299+
cpupower_is_cpu_online(cpu) != 1)
300300
continue;
301301

302302
cpus = cpufreq_get_related_cpus(cpu);
@@ -316,10 +316,7 @@ int cmd_freq_set(int argc, char **argv)
316316
cpu <= bitmask_last(cpus_chosen); cpu++) {
317317

318318
if (!bitmask_isbitset(cpus_chosen, cpu) ||
319-
cpupower_is_cpu_online(cpu))
320-
continue;
321-
322-
if (cpupower_is_cpu_online(cpu) != 1)
319+
cpupower_is_cpu_online(cpu) != 1)
323320
continue;
324321

325322
printf(_("Setting cpu: %d\n"), cpu);

0 commit comments

Comments
 (0)