aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-09-15 23:33:33 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-09-15 23:41:17 -0400
commit1ffa4ad042c3151b57ba3f316d5582166f964537 (patch)
treeb0e79cd6e46bbfdd46ad6041c8d2e0afc19a6d99 /drivers/bluetooth
parent89e7533d0a96860f8aa24d05c9e35b18fdc28a61 (diff)
Bluetooth: btusb: Split fragement receiption into separate functions
The actual packet reassembly should be done inside the driver. To allow this to happen cleanly in future patches, split the fragment reception into its own functions. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btusb.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index cf07fef65fd5..df585ab064fa 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -296,6 +296,21 @@ struct btusb_data {
296 int suspend_count; 296 int suspend_count;
297}; 297};
298 298
299static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)
300{
301 return hci_recv_fragment(data->hdev, HCI_EVENT_PKT, buffer, count);
302}
303
304static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
305{
306 return hci_recv_fragment(data->hdev, HCI_ACLDATA_PKT, buffer, count);
307}
308
309static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count)
310{
311 return hci_recv_fragment(data->hdev, HCI_SCODATA_PKT, buffer, count);
312}
313
299static void btusb_intr_complete(struct urb *urb) 314static void btusb_intr_complete(struct urb *urb)
300{ 315{
301 struct hci_dev *hdev = urb->context; 316 struct hci_dev *hdev = urb->context;
@@ -311,9 +326,8 @@ static void btusb_intr_complete(struct urb *urb)
311 if (urb->status == 0) { 326 if (urb->status == 0) {
312 hdev->stat.byte_rx += urb->actual_length; 327 hdev->stat.byte_rx += urb->actual_length;
313 328
314 if (hci_recv_fragment(hdev, HCI_EVENT_PKT, 329 if (btusb_recv_intr(data, urb->transfer_buffer,
315 urb->transfer_buffer, 330 urb->actual_length) < 0) {
316 urb->actual_length) < 0) {
317 BT_ERR("%s corrupted event packet", hdev->name); 331 BT_ERR("%s corrupted event packet", hdev->name);
318 hdev->stat.err_rx++; 332 hdev->stat.err_rx++;
319 } 333 }
@@ -401,9 +415,8 @@ static void btusb_bulk_complete(struct urb *urb)
401 if (urb->status == 0) { 415 if (urb->status == 0) {
402 hdev->stat.byte_rx += urb->actual_length; 416 hdev->stat.byte_rx += urb->actual_length;
403 417
404 if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT, 418 if (btusb_recv_bulk(data, urb->transfer_buffer,
405 urb->transfer_buffer, 419 urb->actual_length) < 0) {
406 urb->actual_length) < 0) {
407 BT_ERR("%s corrupted ACL packet", hdev->name); 420 BT_ERR("%s corrupted ACL packet", hdev->name);
408 hdev->stat.err_rx++; 421 hdev->stat.err_rx++;
409 } 422 }
@@ -497,9 +510,8 @@ static void btusb_isoc_complete(struct urb *urb)
497 510
498 hdev->stat.byte_rx += length; 511 hdev->stat.byte_rx += length;
499 512
500 if (hci_recv_fragment(hdev, HCI_SCODATA_PKT, 513 if (btusb_recv_isoc(data, urb->transfer_buffer + offset,
501 urb->transfer_buffer + offset, 514 length) < 0) {
502 length) < 0) {
503 BT_ERR("%s corrupted SCO packet", hdev->name); 515 BT_ERR("%s corrupted SCO packet", hdev->name);
504 hdev->stat.err_rx++; 516 hdev->stat.err_rx++;
505 } 517 }