diff options
author | Feng Kan <fkan@apm.com> | 2018-04-11 01:57:06 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-04-24 12:18:25 +0200 |
commit | 494fd7b7ad10c33d3a7ff7d10b71b3ecad10474a (patch) | |
tree | 142266c224b8a9ac90ebb9850861ddbb1c0d118c /drivers/base/core.c | |
parent | Linux 4.17-rc2 (diff) | |
download | linux-494fd7b7ad10c33d3a7ff7d10b71b3ecad10474a.tar.xz linux-494fd7b7ad10c33d3a7ff7d10b71b3ecad10474a.zip |
PM / core: fix deferred probe breaking suspend resume order
When bridge and its endpoint is enumerated the devices are added to the
dpm list. Afterward, the bridge defers probe when IOMMU is not ready.
This causes the bridge to be moved to the end of the dpm list when
deferred probe kicks in. The order of the dpm list for bridge and
endpoint is reversed.
Add reordering code to move the bridge and its children and consumers to
the end of the pm list so the order for suspend and resume is not altered.
The code also move device and its children and consumers to the tail of
device_kset list if it is registered.
Signed-off-by: Toan Le <toanle@apm.com>
Signed-off-by: Feng Kan <fkan@apm.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index b610816eb887..ad7b50897bcc 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -145,6 +145,26 @@ static int device_reorder_to_tail(struct device *dev, void *not_used) } /** + * device_pm_move_to_tail - Move set of devices to the end of device lists + * @dev: Device to move + * + * This is a device_reorder_to_tail() wrapper taking the requisite locks. + * + * It moves the @dev along with all of its children and all of its consumers + * to the ends of the device_kset and dpm_list, recursively. + */ +void device_pm_move_to_tail(struct device *dev) +{ + int idx; + + idx = device_links_read_lock(); + device_pm_lock(); + device_reorder_to_tail(dev, NULL); + device_pm_unlock(); + device_links_read_unlock(idx); +} + +/** * device_link_add - Create a link between two devices. * @consumer: Consumer end of the link. * @supplier: Supplier end of the link. |