Commit 37b63c68 authored by Manish Mandlik's avatar Manish Mandlik Committed by Marcel Holtmann

Bluetooth: msft: Clear tracked devices on resume

Clear already tracked devices on system resume. Once the monitors are
reregistered after resume, matched devices in range will be found again.
Signed-off-by: default avatarManish Mandlik <mmandlik@google.com>
Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent da891217
...@@ -330,12 +330,13 @@ static void msft_le_cancel_monitor_advertisement_cb(struct hci_dev *hdev, ...@@ -330,12 +330,13 @@ static void msft_le_cancel_monitor_advertisement_cb(struct hci_dev *hdev,
/* Do not free the monitor if it is being removed due to /* Do not free the monitor if it is being removed due to
* suspend. It will be re-monitored on resume. * suspend. It will be re-monitored on resume.
*/ */
if (monitor && !msft->suspending) if (monitor && !msft->suspending) {
hci_free_adv_monitor(hdev, monitor); hci_free_adv_monitor(hdev, monitor);
/* Clear any monitored devices by this Adv Monitor */ /* Clear any monitored devices by this Adv Monitor */
msft_monitor_device_del(hdev, handle_data->mgmt_handle, NULL, msft_monitor_device_del(hdev, handle_data->mgmt_handle,
0, false); NULL, 0, false);
}
list_del(&handle_data->list); list_del(&handle_data->list);
kfree(handle_data); kfree(handle_data);
...@@ -522,6 +523,16 @@ int msft_resume_sync(struct hci_dev *hdev) ...@@ -522,6 +523,16 @@ int msft_resume_sync(struct hci_dev *hdev)
if (!msft || !msft_monitor_supported(hdev)) if (!msft || !msft_monitor_supported(hdev))
return 0; return 0;
hci_dev_lock(hdev);
/* Clear already tracked devices on resume. Once the monitors are
* reregistered, devices in range will be found again after resume.
*/
hdev->advmon_pend_notify = false;
msft_monitor_device_del(hdev, 0, NULL, 0, true);
hci_dev_unlock(hdev);
msft->resuming = true; msft->resuming = true;
while (1) { while (1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment