summaryrefslogtreecommitdiff
path: root/net/bluetooth/msft.c
diff options
context:
space:
mode:
authorHoward Chung <howardchung@google.com>2021-01-22 11:36:17 +0300
committerMarcel Holtmann <marcel@holtmann.org>2021-01-25 18:07:37 +0300
commitbf6a4e30ffbd9e9ef8934582feb937f6532f8b68 (patch)
treedfb7cd0fab4d130a2aaff2b9cff09bffd681ae66 /net/bluetooth/msft.c
parent58ceb1e6d6aec5b35722446e004851ada0d59656 (diff)
downloadlinux-bf6a4e30ffbd9e9ef8934582feb937f6532f8b68.tar.xz
Bluetooth: disable advertisement filters during suspend
This adds logic to disable and reenable advertisement filters during suspend and resume. After this patch, we would only receive packets from devices in allow list during suspend. Signed-off-by: Howard Chung <howardchung@google.com> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/msft.c')
-rw-r--r--net/bluetooth/msft.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index b2ef654b1d3d..47b104f318e9 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -579,9 +579,19 @@ int msft_remove_monitor(struct hci_dev *hdev, struct adv_monitor *monitor,
return err;
}
-int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
+void msft_req_add_set_filter_enable(struct hci_request *req, bool enable)
{
+ struct hci_dev *hdev = req->hdev;
struct msft_cp_le_set_advertisement_filter_enable cp;
+
+ cp.sub_opcode = MSFT_OP_LE_SET_ADVERTISEMENT_FILTER_ENABLE;
+ cp.enable = enable;
+
+ hci_req_add(req, hdev->msft_opcode, sizeof(cp), &cp);
+}
+
+int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
+{
struct hci_request req;
struct msft_data *msft = hdev->msft_data;
int err;
@@ -589,11 +599,8 @@ int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
if (!msft)
return -EOPNOTSUPP;
- cp.sub_opcode = MSFT_OP_LE_SET_ADVERTISEMENT_FILTER_ENABLE;
- cp.enable = enable;
-
hci_req_init(&req, hdev);
- hci_req_add(&req, hdev->msft_opcode, sizeof(cp), &cp);
+ msft_req_add_set_filter_enable(&req, enable);
err = hci_req_run_skb(&req, msft_le_set_advertisement_filter_enable_cb);
return err;