Skip to content

Commit f05e6ba

Browse files
apanditgregkh
authored andcommitted
Bluetooth: Clear suspend tasks on unregister
[ Upstream commit 0e99528 ] While unregistering, make sure to clear the suspend tasks before cancelling the work. If the unregister is called during resume from suspend, this will unnecessarily add 2s to the resume time otherwise. Fixes: 4e8c36c (Bluetooth: Fix suspend notifier race) 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>
1 parent df0e32b commit f05e6ba

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

net/bluetooth/hci_core.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,6 +3442,16 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
34423442
}
34433443
}
34443444

3445+
static void hci_suspend_clear_tasks(struct hci_dev *hdev)
3446+
{
3447+
int i;
3448+
3449+
for (i = 0; i < __SUSPEND_NUM_TASKS; i++)
3450+
clear_bit(i, hdev->suspend_tasks);
3451+
3452+
wake_up(&hdev->suspend_wait_q);
3453+
}
3454+
34453455
static int hci_suspend_wait_event(struct hci_dev *hdev)
34463456
{
34473457
#define WAKE_COND \
@@ -3785,6 +3795,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
37853795
cancel_work_sync(&hdev->power_on);
37863796

37873797
unregister_pm_notifier(&hdev->suspend_notifier);
3798+
hci_suspend_clear_tasks(hdev);
37883799
cancel_work_sync(&hdev->suspend_prepare);
37893800

37903801
hci_dev_do_close(hdev);

0 commit comments

Comments
 (0)