aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_request.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-11-11 05:24:23 -0500
committerMarcel Holtmann <marcel@holtmann.org>2015-11-19 11:50:31 -0500
commit3dfe5905a7505bc0cbf5f63405631d8e188d9235 (patch)
treea8590bb2ff4fc69a69f8576e5aca82b2403d2539 /net/bluetooth/hci_request.c
parentf4a2cb4d8f792350ec38b35b94026fc2c4be8d0f (diff)
Bluetooth: Remove unnecessary le_scan_restart_work_complete() function
The only user of this, le_scan_restart_work(), is so short and simple that it makes sense to just merge the code there. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r--net/bluetooth/hci_request.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 04c3357b1e1c..e8345d8106b5 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -950,12 +950,35 @@ discov_stopped:
950 hci_dev_unlock(hdev); 950 hci_dev_unlock(hdev);
951} 951}
952 952
953static void le_scan_restart_work_complete(struct hci_dev *hdev, u8 status) 953static int le_scan_restart(struct hci_request *req, unsigned long opt)
954{
955 struct hci_dev *hdev = req->hdev;
956 struct hci_cp_le_set_scan_enable cp;
957
958 /* If controller is not scanning we are done. */
959 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN))
960 return 0;
961
962 hci_req_add_le_scan_disable(req);
963
964 memset(&cp, 0, sizeof(cp));
965 cp.enable = LE_SCAN_ENABLE;
966 cp.filter_dup = LE_SCAN_FILTER_DUP_ENABLE;
967 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
968
969 return 0;
970}
971
972static void le_scan_restart_work(struct work_struct *work)
954{ 973{
974 struct hci_dev *hdev = container_of(work, struct hci_dev,
975 le_scan_restart.work);
955 unsigned long timeout, duration, scan_start, now; 976 unsigned long timeout, duration, scan_start, now;
977 u8 status;
956 978
957 BT_DBG("%s", hdev->name); 979 BT_DBG("%s", hdev->name);
958 980
981 hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status);
959 if (status) { 982 if (status) {
960 BT_ERR("Failed to restart LE scan: status %d", status); 983 BT_ERR("Failed to restart LE scan: status %d", status);
961 return; 984 return;
@@ -995,41 +1018,6 @@ unlock:
995 hci_dev_unlock(hdev); 1018 hci_dev_unlock(hdev);
996} 1019}
997 1020
998static int le_scan_restart(struct hci_request *req, unsigned long opt)
999{
1000 struct hci_dev *hdev = req->hdev;
1001 struct hci_cp_le_set_scan_enable cp;
1002
1003 /* If controller is not scanning we are done. */
1004 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN))
1005 return 0;
1006
1007 hci_req_add_le_scan_disable(req);
1008
1009 memset(&cp, 0, sizeof(cp));
1010 cp.enable = LE_SCAN_ENABLE;
1011 cp.filter_dup = LE_SCAN_FILTER_DUP_ENABLE;
1012 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
1013
1014 return 0;
1015}
1016
1017static void le_scan_restart_work(struct work_struct *work)
1018{
1019 struct hci_dev *hdev = container_of(work, struct hci_dev,
1020 le_scan_restart.work);
1021 u8 status;
1022 int err;
1023
1024 BT_DBG("%s", hdev->name);
1025
1026 err = hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status);
1027 if (err)
1028 return;
1029
1030 le_scan_restart_work_complete(hdev, status);
1031}
1032
1033static void cancel_adv_timeout(struct hci_dev *hdev) 1021static void cancel_adv_timeout(struct hci_dev *hdev)
1034{ 1022{
1035 if (hdev->adv_instance_timeout) { 1023 if (hdev->adv_instance_timeout) {