diff mbox series

[v3,1/6] Bluetooth: Update Adv monitor count upon removal

Message ID 20200918111110.v3.1.I27ef2a783d8920c147458639f3fa91b69f6fd9ea@changeid
State Superseded
Headers show
Series [v3,1/6] Bluetooth: Update Adv monitor count upon removal | expand

Commit Message

Howard Chung Sept. 18, 2020, 3:11 a.m. UTC
From: Miao-chen Chou <mcchou@chromium.org>

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: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Howard Chung <howardchung@google.com>
Reviewed-by: Alain Michaud <alainm@chromium.org>
---

Changes in v3:
- Remove 'Bluez' prefix

Changes in v2:
- delete 'case 0x001c' in mgmt_config.c

 net/bluetooth/hci_core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marcel Holtmann Sept. 20, 2020, 6:14 a.m. UTC | #1
Hi Howard,

> 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: Miao-chen Chou <mcchou@chromium.org>

> Signed-off-by: Howard Chung <howardchung@google.com>

> Reviewed-by: Alain Michaud <alainm@chromium.org>

> ---

> 

> Changes in v3:

> - Remove 'Bluez' prefix

> 

> Changes in v2:

> - delete 'case 0x001c' in mgmt_config.c

> 

> net/bluetooth/hci_core.c | 2 ++

> 1 file changed, 2 insertions(+)


patch has been applied to bluetooth-next tree.

Regards

Marcel
Marcel Holtmann Sept. 20, 2020, 6:14 a.m. UTC | #2
Hi Howard,

> Set scan parameters when there is at least one Advertisement monitor.

> 

> Signed-off-by: Howard Chung <howardchung@google.com>

> Reviewed-by: Alain Michaud <alainm@chromium.org>

> Reviewed-by: Manish Mandlik <mmandlik@chromium.org>

> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>

> ---

> 

> (no changes since v1)

> 

> net/bluetooth/hci_request.c | 3 +++

> 1 file changed, 3 insertions(+)


patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8a2645a833013..f30a1f5950e15 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3061,6 +3061,7 @@  static int free_adv_monitor(int id, void *ptr, void *data)
 
 	idr_remove(&hdev->adv_monitors_idr, monitor->handle);
 	hci_free_adv_monitor(monitor);
+	hdev->adv_monitors_cnt--;
 
 	return 0;
 }
@@ -3077,6 +3078,7 @@  int hci_remove_adv_monitor(struct hci_dev *hdev, u16 handle)
 
 		idr_remove(&hdev->adv_monitors_idr, monitor->handle);
 		hci_free_adv_monitor(monitor);
+		hdev->adv_monitors_cnt--;
 	} else {
 		/* Remove all monitors if handle is 0. */
 		idr_for_each(&hdev->adv_monitors_idr, &free_adv_monitor, hdev);