]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
PM: runtime: Resume the device earlier in __device_release_driver()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 22 Oct 2020 15:38:22 +0000 (17:38 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 10 Dec 2020 11:06:03 +0000 (12:06 +0100)
commitb39fd84aed5fff2e5328cefdf7746707b46f92eb
tree900cf5476fe474d38de0d8dcb4de06574950fd6c
parentec7fdcbe8a43994c2379a6cc99ca2ae1f977d771
PM: runtime: Resume the device earlier in __device_release_driver()

BugLink: https://bugs.launchpad.net/bugs/1905612
commit 9226c504e364158a17a68ff1fe9d67d266922f50 upstream.

Since the device is resumed from runtime-suspend in
__device_release_driver() anyway, it is better to do that before
looking for busy managed device links from it to consumers, because
if there are any, device_links_unbind_consumers() will be called
and it will cause the consumer devices' drivers to unbind, so the
consumer devices will be runtime-resumed.  In turn, resuming each
consumer device will cause the supplier to be resumed and when the
runtime PM references from the given consumer to it are dropped, it
may be suspended.  Then, the runtime-resume of the next consumer
will cause the supplier to resume again and so on.

Update the code accordingly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
Cc: All applicable <stable@vger.kernel.org> # All applicable
Tested-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/base/dd.c