]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
Bluetooth: Re-order clearing suspend tasks
authorAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
Wed, 9 Sep 2020 23:53:59 +0000 (16:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:11:19 +0000 (10:11 +0100)
[ Upstream commit 3eec158d5eca7dd455118d9e00568aad2371219f ]

Unregister_pm_notifier is a blocking call so suspend tasks should be
cleared beforehand. Otherwise, the notifier will wait for completion
before returning (and we encounter a 2s timeout on resume).

Fixes: 0e9952804ec9c8 (Bluetooth: Clear suspend tasks on unregister)
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_core.c

index efc0fe2b47dac21b81f68e47b895d48308c89a74..be9cdf5dabe5dcecc1229adfeec46d84037b6e84 100644 (file)
@@ -3794,8 +3794,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
 
        cancel_work_sync(&hdev->power_on);
 
-       unregister_pm_notifier(&hdev->suspend_notifier);
        hci_suspend_clear_tasks(hdev);
+       unregister_pm_notifier(&hdev->suspend_notifier);
        cancel_work_sync(&hdev->suspend_prepare);
 
        hci_dev_do_close(hdev);