diff options
-rw-r--r-- | include/net/bluetooth/hci_core.h | 13 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 113 |
2 files changed, 0 insertions, 126 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 1b343ef37871..5de7eb95ef63 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -117,13 +117,6 @@ struct oob_data { | |||
117 | u8 randomizer[16]; | 117 | u8 randomizer[16]; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct le_scan_params { | ||
121 | u8 type; | ||
122 | u16 interval; | ||
123 | u16 window; | ||
124 | int timeout; | ||
125 | }; | ||
126 | |||
127 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | 120 | #define HCI_MAX_SHORT_NAME_LENGTH 10 |
128 | 121 | ||
129 | struct amp_assoc { | 122 | struct amp_assoc { |
@@ -283,9 +276,6 @@ struct hci_dev { | |||
283 | 276 | ||
284 | struct delayed_work le_scan_disable; | 277 | struct delayed_work le_scan_disable; |
285 | 278 | ||
286 | struct work_struct le_scan; | ||
287 | struct le_scan_params le_scan_params; | ||
288 | |||
289 | __s8 adv_tx_power; | 279 | __s8 adv_tx_power; |
290 | __u8 adv_data[HCI_MAX_AD_LENGTH]; | 280 | __u8 adv_data[HCI_MAX_AD_LENGTH]; |
291 | __u8 adv_data_len; | 281 | __u8 adv_data_len; |
@@ -1222,9 +1212,6 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], | |||
1222 | __u8 ltk[16]); | 1212 | __u8 ltk[16]); |
1223 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); | 1213 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); |
1224 | int hci_cancel_inquiry(struct hci_dev *hdev); | 1214 | int hci_cancel_inquiry(struct hci_dev *hdev); |
1225 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, | ||
1226 | int timeout); | ||
1227 | int hci_cancel_le_scan(struct hci_dev *hdev); | ||
1228 | 1215 | ||
1229 | u8 bdaddr_to_le(u8 bdaddr_type); | 1216 | u8 bdaddr_to_le(u8 bdaddr_type); |
1230 | 1217 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9270d7ee489d..100539fcbfe5 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1201,8 +1201,6 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
1201 | { | 1201 | { |
1202 | BT_DBG("%s %p", hdev->name, hdev); | 1202 | BT_DBG("%s %p", hdev->name, hdev); |
1203 | 1203 | ||
1204 | cancel_work_sync(&hdev->le_scan); | ||
1205 | |||
1206 | cancel_delayed_work(&hdev->power_off); | 1204 | cancel_delayed_work(&hdev->power_off); |
1207 | 1205 | ||
1208 | hci_req_cancel(hdev, ENODEV); | 1206 | hci_req_cancel(hdev, ENODEV); |
@@ -1991,82 +1989,6 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) | |||
1991 | return mgmt_device_unblocked(hdev, bdaddr, type); | 1989 | return mgmt_device_unblocked(hdev, bdaddr, type); |
1992 | } | 1990 | } |
1993 | 1991 | ||
1994 | static void le_scan_param_req(struct hci_request *req, unsigned long opt) | ||
1995 | { | ||
1996 | struct le_scan_params *param = (struct le_scan_params *) opt; | ||
1997 | struct hci_cp_le_set_scan_param cp; | ||
1998 | |||
1999 | memset(&cp, 0, sizeof(cp)); | ||
2000 | cp.type = param->type; | ||
2001 | cp.interval = cpu_to_le16(param->interval); | ||
2002 | cp.window = cpu_to_le16(param->window); | ||
2003 | |||
2004 | hci_req_add(req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(cp), &cp); | ||
2005 | } | ||
2006 | |||
2007 | static void le_scan_enable_req(struct hci_request *req, unsigned long opt) | ||
2008 | { | ||
2009 | struct hci_cp_le_set_scan_enable cp; | ||
2010 | |||
2011 | memset(&cp, 0, sizeof(cp)); | ||
2012 | cp.enable = LE_SCAN_ENABLE; | ||
2013 | cp.filter_dup = LE_SCAN_FILTER_DUP_ENABLE; | ||
2014 | |||
2015 | hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); | ||
2016 | } | ||
2017 | |||
2018 | static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval, | ||
2019 | u16 window, int timeout) | ||
2020 | { | ||
2021 | long timeo = msecs_to_jiffies(3000); | ||
2022 | struct le_scan_params param; | ||
2023 | int err; | ||
2024 | |||
2025 | BT_DBG("%s", hdev->name); | ||
2026 | |||
2027 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | ||
2028 | return -EINPROGRESS; | ||
2029 | |||
2030 | param.type = type; | ||
2031 | param.interval = interval; | ||
2032 | param.window = window; | ||
2033 | |||
2034 | hci_req_lock(hdev); | ||
2035 | |||
2036 | err = __hci_req_sync(hdev, le_scan_param_req, (unsigned long) ¶m, | ||
2037 | timeo); | ||
2038 | if (!err) | ||
2039 | err = __hci_req_sync(hdev, le_scan_enable_req, 0, timeo); | ||
2040 | |||
2041 | hci_req_unlock(hdev); | ||
2042 | |||
2043 | if (err < 0) | ||
2044 | return err; | ||
2045 | |||
2046 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | ||
2047 | timeout); | ||
2048 | |||
2049 | return 0; | ||
2050 | } | ||
2051 | |||
2052 | int hci_cancel_le_scan(struct hci_dev *hdev) | ||
2053 | { | ||
2054 | BT_DBG("%s", hdev->name); | ||
2055 | |||
2056 | if (!test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | ||
2057 | return -EALREADY; | ||
2058 | |||
2059 | if (cancel_delayed_work(&hdev->le_scan_disable)) { | ||
2060 | struct hci_cp_le_set_scan_enable cp; | ||
2061 | |||
2062 | /* Send HCI command to disable LE Scan */ | ||
2063 | memset(&cp, 0, sizeof(cp)); | ||
2064 | hci_send_cmd(hdev, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); | ||
2065 | } | ||
2066 | |||
2067 | return 0; | ||
2068 | } | ||
2069 | |||
2070 | static void inquiry_complete(struct hci_dev *hdev, u8 status) | 1992 | static void inquiry_complete(struct hci_dev *hdev, u8 status) |
2071 | { | 1993 | { |
2072 | if (status) { | 1994 | if (status) { |
@@ -2143,40 +2065,6 @@ static void le_scan_disable_work(struct work_struct *work) | |||
2143 | BT_ERR("Disable LE scanning request failed: err %d", err); | 2065 | BT_ERR("Disable LE scanning request failed: err %d", err); |
2144 | } | 2066 | } |
2145 | 2067 | ||
2146 | static void le_scan_work(struct work_struct *work) | ||
2147 | { | ||
2148 | struct hci_dev *hdev = container_of(work, struct hci_dev, le_scan); | ||
2149 | struct le_scan_params *param = &hdev->le_scan_params; | ||
2150 | |||
2151 | BT_DBG("%s", hdev->name); | ||
2152 | |||
2153 | hci_do_le_scan(hdev, param->type, param->interval, param->window, | ||
2154 | param->timeout); | ||
2155 | } | ||
2156 | |||
2157 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, | ||
2158 | int timeout) | ||
2159 | { | ||
2160 | struct le_scan_params *param = &hdev->le_scan_params; | ||
2161 | |||
2162 | BT_DBG("%s", hdev->name); | ||
2163 | |||
2164 | if (test_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags)) | ||
2165 | return -ENOTSUPP; | ||
2166 | |||
2167 | if (work_busy(&hdev->le_scan)) | ||
2168 | return -EINPROGRESS; | ||
2169 | |||
2170 | param->type = type; | ||
2171 | param->interval = interval; | ||
2172 | param->window = window; | ||
2173 | param->timeout = timeout; | ||
2174 | |||
2175 | queue_work(system_long_wq, &hdev->le_scan); | ||
2176 | |||
2177 | return 0; | ||
2178 | } | ||
2179 | |||
2180 | /* Alloc HCI device */ | 2068 | /* Alloc HCI device */ |
2181 | struct hci_dev *hci_alloc_dev(void) | 2069 | struct hci_dev *hci_alloc_dev(void) |
2182 | { | 2070 | { |
@@ -2211,7 +2099,6 @@ struct hci_dev *hci_alloc_dev(void) | |||
2211 | INIT_WORK(&hdev->cmd_work, hci_cmd_work); | 2099 | INIT_WORK(&hdev->cmd_work, hci_cmd_work); |
2212 | INIT_WORK(&hdev->tx_work, hci_tx_work); | 2100 | INIT_WORK(&hdev->tx_work, hci_tx_work); |
2213 | INIT_WORK(&hdev->power_on, hci_power_on); | 2101 | INIT_WORK(&hdev->power_on, hci_power_on); |
2214 | INIT_WORK(&hdev->le_scan, le_scan_work); | ||
2215 | 2102 | ||
2216 | INIT_DELAYED_WORK(&hdev->power_off, hci_power_off); | 2103 | INIT_DELAYED_WORK(&hdev->power_off, hci_power_off); |
2217 | INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off); | 2104 | INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off); |