Commit c88e3979 authored by Miao-chen Chou's avatar Miao-chen Chou Committed by Marcel Holtmann

Bluetooth: Update Adv monitor count upon removal

This fixes the count of Adv monitor upon monitor removal.

The following test was performed.
- Start two btmgmt consoles, issue a btmgmt advmon-remove command on one
console and observe a MGMT_EV_ADV_MONITOR_REMOVED event on the other.
Signed-off-by: default avatarMiao-chen Chou <mcchou@chromium.org>
Signed-off-by: default avatarHoward Chung <howardchung@google.com>
Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 81ebea53
...@@ -3061,6 +3061,7 @@ static int free_adv_monitor(int id, void *ptr, void *data) ...@@ -3061,6 +3061,7 @@ static int free_adv_monitor(int id, void *ptr, void *data)
idr_remove(&hdev->adv_monitors_idr, monitor->handle); idr_remove(&hdev->adv_monitors_idr, monitor->handle);
hci_free_adv_monitor(monitor); hci_free_adv_monitor(monitor);
hdev->adv_monitors_cnt--;
return 0; return 0;
} }
...@@ -3077,6 +3078,7 @@ int hci_remove_adv_monitor(struct hci_dev *hdev, u16 handle) ...@@ -3077,6 +3078,7 @@ int hci_remove_adv_monitor(struct hci_dev *hdev, u16 handle)
idr_remove(&hdev->adv_monitors_idr, monitor->handle); idr_remove(&hdev->adv_monitors_idr, monitor->handle);
hci_free_adv_monitor(monitor); hci_free_adv_monitor(monitor);
hdev->adv_monitors_cnt--;
} else { } else {
/* Remove all monitors if handle is 0. */ /* Remove all monitors if handle is 0. */
idr_for_each(&hdev->adv_monitors_idr, &free_adv_monitor, hdev); idr_for_each(&hdev->adv_monitors_idr, &free_adv_monitor, hdev);
......
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