diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2013-04-30 14:29:37 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-06-22 19:23:51 -0400 |
commit | 917eedc56c65ba96a3bab4c346d948e73dd872f1 (patch) | |
tree | acf175b02bc75f4e8bbaf106839e043d34526bdb /net | |
parent | 3fd319b830247a3fe5f489e622ab404b618e0906 (diff) |
Bluetooth: Remove LE scan helpers
This patch removes the LE scan helpers hci_le_scan and hci_cancel_
le_scan and all code related to it. We now use the HCI request
framework in device discovery functionality and these helpers are
no longer needed.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 113 |
1 files changed, 0 insertions, 113 deletions
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); |