Skip to content

Commit 928265e

Browse files
committed
PM: sleep: Do not let "syscore" devices runtime-suspend during system transitions
There is no reason to allow "syscore" devices to runtime-suspend during system-wide PM transitions, because they are subject to the same possible failure modes as any other devices in that respect. Accordingly, change device_prepare() and device_complete() to call pm_runtime_get_noresume() and pm_runtime_put(), respectively, for "syscore" devices too. Fixes: 057d51a ("Merge branch 'pm-sleep'") Signed-off-by: Rafael J. Wysocki <[email protected]> Cc: 3.10+ <[email protected]> # 3.10+ Reviewed-by: Ulf Hansson <[email protected]>
1 parent 39fbef4 commit 928265e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/base/power/main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ static void device_complete(struct device *dev, pm_message_t state)
10511051
const char *info = NULL;
10521052

10531053
if (dev->power.syscore)
1054-
return;
1054+
goto out;
10551055

10561056
device_lock(dev);
10571057

@@ -1081,6 +1081,7 @@ static void device_complete(struct device *dev, pm_message_t state)
10811081

10821082
device_unlock(dev);
10831083

1084+
out:
10841085
pm_runtime_put(dev);
10851086
}
10861087

@@ -1794,9 +1795,6 @@ static int device_prepare(struct device *dev, pm_message_t state)
17941795
int (*callback)(struct device *) = NULL;
17951796
int ret = 0;
17961797

1797-
if (dev->power.syscore)
1798-
return 0;
1799-
18001798
/*
18011799
* If a device's parent goes into runtime suspend at the wrong time,
18021800
* it won't be possible to resume the device. To prevent this we
@@ -1805,6 +1803,9 @@ static int device_prepare(struct device *dev, pm_message_t state)
18051803
*/
18061804
pm_runtime_get_noresume(dev);
18071805

1806+
if (dev->power.syscore)
1807+
return 0;
1808+
18081809
device_lock(dev);
18091810

18101811
dev->power.wakeup_path = false;

0 commit comments

Comments
 (0)