Skip to content

Commit

Permalink
PM: sleep: Do not let "syscore" devices runtime-suspend during system…
Browse files Browse the repository at this point in the history
… transitions

commit 928265e upstream.

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 <rafael.j.wysocki@intel.com>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
rafaeljw authored and gregkh committed Nov 17, 2021
1 parent 0f2d037 commit ad34c5f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/base/power/main.c
Expand Up @@ -1051,7 +1051,7 @@ static void device_complete(struct device *dev, pm_message_t state)
const char *info = NULL;

if (dev->power.syscore)
return;
goto out;

device_lock(dev);

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

device_unlock(dev);

out:
pm_runtime_put(dev);
}

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

if (dev->power.syscore)
return 0;

/*
* If a device's parent goes into runtime suspend at the wrong time,
* it won't be possible to resume the device. To prevent this we
Expand All @@ -1805,6 +1803,9 @@ static int device_prepare(struct device *dev, pm_message_t state)
*/
pm_runtime_get_noresume(dev);

if (dev->power.syscore)
return 0;

device_lock(dev);

dev->power.wakeup_path = false;
Expand Down

0 comments on commit ad34c5f

Please sign in to comment.