Skip to content

Commit c1df456

Browse files
storulfrafaeljw
authored andcommitted
PM: domains: Don't runtime resume devices at genpd_prepare()
Runtime resuming a device upfront in the genpd_prepare() callback, to check if there is a wakeup pending for it, seems like an unnecessary thing to do. The PM core already manages these kind of things in a common way in __device_suspend(), via calling pm_runtime_barrier() and pm_wakeup_pending(). Therefore, let's simply drop this behaviour from genpd_prepare(). Note that, this change is applicable only for devices that are attached to a genpd that has the GENPD_FLAG_ACTIVE_WAKEUP set (Renesas, Mediatek, and Rockchip platforms). Moreover, a driver that needs to restore power for its device to re-configure it for a system wakeup, may still call pm_runtime_get_sync(), for example, to do this. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1e28eed commit c1df456

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

drivers/base/power/domain.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,34 +1087,6 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
10871087
genpd->status = GENPD_STATE_ON;
10881088
}
10891089

1090-
/**
1091-
* resume_needed - Check whether to resume a device before system suspend.
1092-
* @dev: Device to check.
1093-
* @genpd: PM domain the device belongs to.
1094-
*
1095-
* There are two cases in which a device that can wake up the system from sleep
1096-
* states should be resumed by genpd_prepare(): (1) if the device is enabled
1097-
* to wake up the system and it has to remain active for this purpose while the
1098-
* system is in the sleep state and (2) if the device is not enabled to wake up
1099-
* the system from sleep states and it generally doesn't generate wakeup signals
1100-
* by itself (those signals are generated on its behalf by other parts of the
1101-
* system). In the latter case it may be necessary to reconfigure the device's
1102-
* wakeup settings during system suspend, because it may have been set up to
1103-
* signal remote wakeup from the system's working state as needed by runtime PM.
1104-
* Return 'true' in either of the above cases.
1105-
*/
1106-
static bool resume_needed(struct device *dev,
1107-
const struct generic_pm_domain *genpd)
1108-
{
1109-
bool active_wakeup;
1110-
1111-
if (!device_can_wakeup(dev))
1112-
return false;
1113-
1114-
active_wakeup = genpd_is_active_wakeup(genpd);
1115-
return device_may_wakeup(dev) ? active_wakeup : !active_wakeup;
1116-
}
1117-
11181090
/**
11191091
* genpd_prepare - Start power transition of a device in a PM domain.
11201092
* @dev: Device to start the transition of.
@@ -1135,14 +1107,6 @@ static int genpd_prepare(struct device *dev)
11351107
if (IS_ERR(genpd))
11361108
return -EINVAL;
11371109

1138-
/*
1139-
* If a wakeup request is pending for the device, it should be woken up
1140-
* at this point and a system wakeup event should be reported if it's
1141-
* set up to wake up the system from sleep states.
1142-
*/
1143-
if (resume_needed(dev, genpd))
1144-
pm_runtime_resume(dev);
1145-
11461110
genpd_lock(genpd);
11471111

11481112
if (genpd->prepared_count++ == 0)

0 commit comments

Comments
 (0)