diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2011-12-19 09:31:27 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-20 13:59:12 -0500 |
commit | e61ef49966777defa84b04159ea23cdeb2c7cd4c (patch) | |
tree | 4614cde7459c15e650df65e440cd33a4c6e00e59 /net/bluetooth/hci_core.c | |
parent | 27bf88829f50cf1af2b052ecee2f6f0dbe4a5141 (diff) |
Bluetooth: Split ctrl init to BREDR and AMP parts
Current controller initialization is moved tp bredr_init and new
function added amp_init to handle later AMP init sequence. Current
AMP init sequence include Reset and Read Local Version.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 64 |
1 files changed, 46 insertions, 18 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index d6382dbb7b76..bb089e3bccef 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -193,33 +193,18 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt) | |||
193 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); | 193 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); |
194 | } | 194 | } |
195 | 195 | ||
196 | static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | 196 | static void bredr_init(struct hci_dev *hdev) |
197 | { | 197 | { |
198 | struct hci_cp_delete_stored_link_key cp; | 198 | struct hci_cp_delete_stored_link_key cp; |
199 | struct sk_buff *skb; | ||
200 | __le16 param; | 199 | __le16 param; |
201 | __u8 flt_type; | 200 | __u8 flt_type; |
202 | 201 | ||
203 | BT_DBG("%s %ld", hdev->name, opt); | ||
204 | |||
205 | /* Driver initialization */ | ||
206 | |||
207 | /* Special commands */ | ||
208 | while ((skb = skb_dequeue(&hdev->driver_init))) { | ||
209 | bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; | ||
210 | skb->dev = (void *) hdev; | ||
211 | |||
212 | skb_queue_tail(&hdev->cmd_q, skb); | ||
213 | queue_work(hdev->workqueue, &hdev->cmd_work); | ||
214 | } | ||
215 | skb_queue_purge(&hdev->driver_init); | ||
216 | |||
217 | /* Mandatory initialization */ | 202 | /* Mandatory initialization */ |
218 | 203 | ||
219 | /* Reset */ | 204 | /* Reset */ |
220 | if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) { | 205 | if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) { |
221 | set_bit(HCI_RESET, &hdev->flags); | 206 | set_bit(HCI_RESET, &hdev->flags); |
222 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); | 207 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); |
223 | } | 208 | } |
224 | 209 | ||
225 | /* Read Local Supported Features */ | 210 | /* Read Local Supported Features */ |
@@ -258,6 +243,49 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | |||
258 | hci_send_cmd(hdev, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); | 243 | hci_send_cmd(hdev, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); |
259 | } | 244 | } |
260 | 245 | ||
246 | static void amp_init(struct hci_dev *hdev) | ||
247 | { | ||
248 | /* Reset */ | ||
249 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); | ||
250 | |||
251 | /* Read Local Version */ | ||
252 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL); | ||
253 | } | ||
254 | |||
255 | static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | ||
256 | { | ||
257 | struct sk_buff *skb; | ||
258 | |||
259 | BT_DBG("%s %ld", hdev->name, opt); | ||
260 | |||
261 | /* Driver initialization */ | ||
262 | |||
263 | /* Special commands */ | ||
264 | while ((skb = skb_dequeue(&hdev->driver_init))) { | ||
265 | bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; | ||
266 | skb->dev = (void *) hdev; | ||
267 | |||
268 | skb_queue_tail(&hdev->cmd_q, skb); | ||
269 | queue_work(hdev->workqueue, &hdev->cmd_work); | ||
270 | } | ||
271 | skb_queue_purge(&hdev->driver_init); | ||
272 | |||
273 | switch (hdev->dev_type) { | ||
274 | case HCI_BREDR: | ||
275 | bredr_init(hdev); | ||
276 | break; | ||
277 | |||
278 | case HCI_AMP: | ||
279 | amp_init(hdev); | ||
280 | break; | ||
281 | |||
282 | default: | ||
283 | BT_ERR("Unknown device type %d", hdev->dev_type); | ||
284 | break; | ||
285 | } | ||
286 | |||
287 | } | ||
288 | |||
261 | static void hci_le_init_req(struct hci_dev *hdev, unsigned long opt) | 289 | static void hci_le_init_req(struct hci_dev *hdev, unsigned long opt) |
262 | { | 290 | { |
263 | BT_DBG("%s", hdev->name); | 291 | BT_DBG("%s", hdev->name); |