diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2014-02-26 20:21:40 -0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-26 19:41:33 -0800 |
commit | b1efcc2870687ec3e3c51fa72210b8e4fa465df8 (patch) | |
tree | 480514a66414891dd560b11447a26af285d88720 /net/bluetooth/hci_core.c | |
parent | 4bd6d38e7f58b163138d3fea8fa135de523bfb92 (diff) | |
download | talos-op-linux-b1efcc2870687ec3e3c51fa72210b8e4fa465df8.tar.gz talos-op-linux-b1efcc2870687ec3e3c51fa72210b8e4fa465df8.zip |
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.c | 14 |
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) { struct hci_dev *hdev = container_of(work, struct hci_dev, le_scan_disable.work); - struct hci_cp_le_set_scan_enable cp; struct hci_request req; int err; @@ -3326,9 +3325,7 @@ static void le_scan_disable_work(struct work_struct *work) hci_req_init(&req, hdev); - memset(&cp, 0, sizeof(cp)); - cp.enable = LE_SCAN_DISABLE; - hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); + hci_req_add_le_scan_disable(&req); err = hci_req_run(&req, le_scan_disable_work_complete); if (err) @@ -4872,3 +4869,12 @@ static void hci_cmd_work(struct work_struct *work) } } } + +void hci_req_add_le_scan_disable(struct hci_request *req) +{ + struct hci_cp_le_set_scan_enable cp; + + memset(&cp, 0, sizeof(cp)); + cp.enable = LE_SCAN_DISABLE; + hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); +} |