diff options
author | 2021-10-27 16:58:41 -0700 | |
---|---|---|
committer | 2021-10-29 16:51:58 +0200 | |
commit | e8907f76544ffe225ab95d70f7313267b1d0c76d (patch) | |
tree | cd309d7e6c0ccf544c77adacdf6a72ac97d87f07 /net/bluetooth/mgmt.c | |
parent | Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2 (diff) | |
download | wireguard-linux-e8907f76544ffe225ab95d70f7313267b1d0c76d.tar.xz wireguard-linux-e8907f76544ffe225ab95d70f7313267b1d0c76d.zip |
Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3
This make use of hci_cmd_sync_queue for the following MGMT commands:
Add Device
Remove Device
Tested with:
mgmt-tester -s "Add Device"
Test Summary
------------
Add Device - Invalid Params 1 Passed
Add Device - Invalid Params 2 Passed
Add Device - Invalid Params 3 Passed
Add Device - Invalid Params 4 Passed
Add Device - Success 1 Passed
Add Device - Success 2 Passed
Add Device - Success 3 Passed
Add Device - Success 4 Passed
Add Device - Success 5 Passed
Add Device - Success 6 - Add to whitelist Passed
Add Device - Success 7 - Add to resolv list Passed
Add Device - Success 8 - Enable resolv list Passed
Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
Overall execution time: 0.209 seconds
mgmt-tester -s "Remove Device"
Test Summary
------------
Remove Device - Invalid Params 1 Passed
Remove Device - Invalid Params 2 Passed
Remove Device - Invalid Params 3 Passed
Remove Device - Success 1 Passed
Remove Device - Success 2 Passed
Remove Device - Success 3 Passed
Remove Device - Success 4 Passed
Remove Device - Success 5 Passed
Remove Device - Success 6 - All Devices Passed
Remove Device - Success 7 - Remove from whitelist Passed
Remove Device - Success 8 - Remove from resolv list Passed
Total: 11, Passed: 11 (100.0%), Failed: 0, Not Run: 0
Overall execution time: 4.26 seconds
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to '')
-rw-r--r-- | net/bluetooth/mgmt.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 6e481ca86303..ef61b152c627 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -6927,6 +6927,11 @@ static void device_added(struct sock *sk, struct hci_dev *hdev, mgmt_event(MGMT_EV_DEVICE_ADDED, hdev, &ev, sizeof(ev), sk); } +static int add_device_sync(struct hci_dev *hdev, void *data) +{ + return hci_update_passive_scan_sync(hdev); +} + static int add_device(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) { @@ -7009,7 +7014,9 @@ static int add_device(struct sock *sk, struct hci_dev *hdev, current_flags = params->current_flags; } - hci_update_background_scan(hdev); + err = hci_cmd_sync_queue(hdev, add_device_sync, NULL, NULL); + if (err < 0) + goto unlock; added: device_added(sk, hdev, &cp->addr.bdaddr, cp->addr.type, cp->action); @@ -7036,6 +7043,11 @@ static void device_removed(struct sock *sk, struct hci_dev *hdev, mgmt_event(MGMT_EV_DEVICE_REMOVED, hdev, &ev, sizeof(ev), sk); } +static int remove_device_sync(struct hci_dev *hdev, void *data) +{ + return hci_update_passive_scan_sync(hdev); +} + static int remove_device(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) { @@ -7115,7 +7127,6 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev, list_del(¶ms->action); list_del(¶ms->list); kfree(params); - hci_update_background_scan(hdev); device_removed(sk, hdev, &cp->addr.bdaddr, cp->addr.type); } else { @@ -7152,10 +7163,10 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev, } bt_dev_dbg(hdev, "All LE connection parameters were removed"); - - hci_update_background_scan(hdev); } + hci_cmd_sync_queue(hdev, remove_device_sync, NULL, NULL); + complete: err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_REMOVE_DEVICE, MGMT_STATUS_SUCCESS, &cp->addr, |