aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2014-02-26 18:21:40 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-02-26 22:41:33 -0500
commitb1efcc2870687ec3e3c51fa72210b8e4fa465df8 (patch)
tree480514a66414891dd560b11447a26af285d88720 /net/bluetooth/hci_core.c
parent4bd6d38e7f58b163138d3fea8fa135de523bfb92 (diff)
Bluetooth: Create hci_req_add_le_scan_disable helper
This patch moves stop LE scanning duplicate code to one single place and reuses it. This will avoid more duplicate code in upcoming patches. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 669c76ec659a..9a078cf81d3f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3318,7 +3318,6 @@ static void le_scan_disable_work(struct work_struct *work)
3318{ 3318{
3319 struct hci_dev *hdev = container_of(work, struct hci_dev, 3319 struct hci_dev *hdev = container_of(work, struct hci_dev,
3320 le_scan_disable.work); 3320 le_scan_disable.work);
3321 struct hci_cp_le_set_scan_enable cp;
3322 struct hci_request req; 3321 struct hci_request req;
3323 int err; 3322 int err;
3324 3323
@@ -3326,9 +3325,7 @@ static void le_scan_disable_work(struct work_struct *work)
3326 3325
3327 hci_req_init(&req, hdev); 3326 hci_req_init(&req, hdev);
3328 3327
3329 memset(&cp, 0, sizeof(cp)); 3328 hci_req_add_le_scan_disable(&req);
3330 cp.enable = LE_SCAN_DISABLE;
3331 hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
3332 3329
3333 err = hci_req_run(&req, le_scan_disable_work_complete); 3330 err = hci_req_run(&req, le_scan_disable_work_complete);
3334 if (err) 3331 if (err)
@@ -4872,3 +4869,12 @@ static void hci_cmd_work(struct work_struct *work)
4872 } 4869 }
4873 } 4870 }
4874} 4871}
4872
4873void hci_req_add_le_scan_disable(struct hci_request *req)
4874{
4875 struct hci_cp_le_set_scan_enable cp;
4876
4877 memset(&cp, 0, sizeof(cp));
4878 cp.enable = LE_SCAN_DISABLE;
4879 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
4880}