diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 22:37:40 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 22:37:40 -0400 |
commit | 50b65cc6fa3a69bdfbc8b3342d8ca6ddbbf5ec88 (patch) | |
tree | 12d6cd90cc58808fb78986116502dac82df4f512 /drivers | |
parent | 29578624e354f56143d92510fff33a8b2aaa2c03 (diff) | |
parent | 5b7f990927fe87ad3bec762a33c0e72bcbf6841e (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/bluetooth/hci_usb.c | 88 | ||||
-rw-r--r-- | drivers/bluetooth/hci_usb.h | 5 | ||||
-rw-r--r-- | drivers/bluetooth/hci_vhci.c | 6 |
3 files changed, 4 insertions, 95 deletions
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index 7e04dd69f6..59b054810e 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -199,7 +199,6 @@ static void hci_usb_tx_complete(struct urb *urb); | |||
199 | #define __pending_q(husb, type) (&husb->pending_q[type-1]) | 199 | #define __pending_q(husb, type) (&husb->pending_q[type-1]) |
200 | #define __completed_q(husb, type) (&husb->completed_q[type-1]) | 200 | #define __completed_q(husb, type) (&husb->completed_q[type-1]) |
201 | #define __transmit_q(husb, type) (&husb->transmit_q[type-1]) | 201 | #define __transmit_q(husb, type) (&husb->transmit_q[type-1]) |
202 | #define __reassembly(husb, type) (husb->reassembly[type-1]) | ||
203 | 202 | ||
204 | static inline struct _urb *__get_completed(struct hci_usb *husb, int type) | 203 | static inline struct _urb *__get_completed(struct hci_usb *husb, int type) |
205 | { | 204 | { |
@@ -429,12 +428,6 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb) | |||
429 | kfree(urb->transfer_buffer); | 428 | kfree(urb->transfer_buffer); |
430 | _urb_free(_urb); | 429 | _urb_free(_urb); |
431 | } | 430 | } |
432 | |||
433 | /* Release reassembly buffers */ | ||
434 | if (husb->reassembly[i]) { | ||
435 | kfree_skb(husb->reassembly[i]); | ||
436 | husb->reassembly[i] = NULL; | ||
437 | } | ||
438 | } | 431 | } |
439 | } | 432 | } |
440 | 433 | ||
@@ -671,83 +664,6 @@ static int hci_usb_send_frame(struct sk_buff *skb) | |||
671 | return 0; | 664 | return 0; |
672 | } | 665 | } |
673 | 666 | ||
674 | static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int count) | ||
675 | { | ||
676 | BT_DBG("%s type %d data %p count %d", husb->hdev->name, type, data, count); | ||
677 | |||
678 | husb->hdev->stat.byte_rx += count; | ||
679 | |||
680 | while (count) { | ||
681 | struct sk_buff *skb = __reassembly(husb, type); | ||
682 | struct { int expect; } *scb; | ||
683 | int len = 0; | ||
684 | |||
685 | if (!skb) { | ||
686 | /* Start of the frame */ | ||
687 | |||
688 | switch (type) { | ||
689 | case HCI_EVENT_PKT: | ||
690 | if (count >= HCI_EVENT_HDR_SIZE) { | ||
691 | struct hci_event_hdr *h = data; | ||
692 | len = HCI_EVENT_HDR_SIZE + h->plen; | ||
693 | } else | ||
694 | return -EILSEQ; | ||
695 | break; | ||
696 | |||
697 | case HCI_ACLDATA_PKT: | ||
698 | if (count >= HCI_ACL_HDR_SIZE) { | ||
699 | struct hci_acl_hdr *h = data; | ||
700 | len = HCI_ACL_HDR_SIZE + __le16_to_cpu(h->dlen); | ||
701 | } else | ||
702 | return -EILSEQ; | ||
703 | break; | ||
704 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
705 | case HCI_SCODATA_PKT: | ||
706 | if (count >= HCI_SCO_HDR_SIZE) { | ||
707 | struct hci_sco_hdr *h = data; | ||
708 | len = HCI_SCO_HDR_SIZE + h->dlen; | ||
709 | } else | ||
710 | return -EILSEQ; | ||
711 | break; | ||
712 | #endif | ||
713 | } | ||
714 | BT_DBG("new packet len %d", len); | ||
715 | |||
716 | skb = bt_skb_alloc(len, GFP_ATOMIC); | ||
717 | if (!skb) { | ||
718 | BT_ERR("%s no memory for the packet", husb->hdev->name); | ||
719 | return -ENOMEM; | ||
720 | } | ||
721 | skb->dev = (void *) husb->hdev; | ||
722 | bt_cb(skb)->pkt_type = type; | ||
723 | |||
724 | __reassembly(husb, type) = skb; | ||
725 | |||
726 | scb = (void *) skb->cb; | ||
727 | scb->expect = len; | ||
728 | } else { | ||
729 | /* Continuation */ | ||
730 | scb = (void *) skb->cb; | ||
731 | len = scb->expect; | ||
732 | } | ||
733 | |||
734 | len = min(len, count); | ||
735 | |||
736 | memcpy(skb_put(skb, len), data, len); | ||
737 | |||
738 | scb->expect -= len; | ||
739 | if (!scb->expect) { | ||
740 | /* Complete frame */ | ||
741 | __reassembly(husb, type) = NULL; | ||
742 | bt_cb(skb)->pkt_type = type; | ||
743 | hci_recv_frame(skb); | ||
744 | } | ||
745 | |||
746 | count -= len; data += len; | ||
747 | } | ||
748 | return 0; | ||
749 | } | ||
750 | |||
751 | static void hci_usb_rx_complete(struct urb *urb) | 667 | static void hci_usb_rx_complete(struct urb *urb) |
752 | { | 668 | { |
753 | struct _urb *_urb = container_of(urb, struct _urb, urb); | 669 | struct _urb *_urb = container_of(urb, struct _urb, urb); |
@@ -776,7 +692,7 @@ static void hci_usb_rx_complete(struct urb *urb) | |||
776 | urb->iso_frame_desc[i].actual_length); | 692 | urb->iso_frame_desc[i].actual_length); |
777 | 693 | ||
778 | if (!urb->iso_frame_desc[i].status) | 694 | if (!urb->iso_frame_desc[i].status) |
779 | __recv_frame(husb, _urb->type, | 695 | hci_recv_fragment(husb->hdev, _urb->type, |
780 | urb->transfer_buffer + urb->iso_frame_desc[i].offset, | 696 | urb->transfer_buffer + urb->iso_frame_desc[i].offset, |
781 | urb->iso_frame_desc[i].actual_length); | 697 | urb->iso_frame_desc[i].actual_length); |
782 | } | 698 | } |
@@ -784,7 +700,7 @@ static void hci_usb_rx_complete(struct urb *urb) | |||
784 | ; | 700 | ; |
785 | #endif | 701 | #endif |
786 | } else { | 702 | } else { |
787 | err = __recv_frame(husb, _urb->type, urb->transfer_buffer, count); | 703 | err = hci_recv_fragment(husb->hdev, _urb->type, urb->transfer_buffer, count); |
788 | if (err < 0) { | 704 | if (err < 0) { |
789 | BT_ERR("%s corrupted packet: type %d count %d", | 705 | BT_ERR("%s corrupted packet: type %d count %d", |
790 | husb->hdev->name, _urb->type, count); | 706 | husb->hdev->name, _urb->type, count); |
diff --git a/drivers/bluetooth/hci_usb.h b/drivers/bluetooth/hci_usb.h index 963fc55cdc..56cd3a92ce 100644 --- a/drivers/bluetooth/hci_usb.h +++ b/drivers/bluetooth/hci_usb.h | |||
@@ -102,9 +102,9 @@ struct hci_usb { | |||
102 | struct hci_dev *hdev; | 102 | struct hci_dev *hdev; |
103 | 103 | ||
104 | unsigned long state; | 104 | unsigned long state; |
105 | 105 | ||
106 | struct usb_device *udev; | 106 | struct usb_device *udev; |
107 | 107 | ||
108 | struct usb_host_endpoint *bulk_in_ep; | 108 | struct usb_host_endpoint *bulk_in_ep; |
109 | struct usb_host_endpoint *bulk_out_ep; | 109 | struct usb_host_endpoint *bulk_out_ep; |
110 | struct usb_host_endpoint *intr_in_ep; | 110 | struct usb_host_endpoint *intr_in_ep; |
@@ -116,7 +116,6 @@ struct hci_usb { | |||
116 | __u8 ctrl_req; | 116 | __u8 ctrl_req; |
117 | 117 | ||
118 | struct sk_buff_head transmit_q[4]; | 118 | struct sk_buff_head transmit_q[4]; |
119 | struct sk_buff *reassembly[4]; /* Reassembly buffers */ | ||
120 | 119 | ||
121 | rwlock_t completion_lock; | 120 | rwlock_t completion_lock; |
122 | 121 | ||
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index b71a5ccc58..0638730a4a 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -180,11 +180,6 @@ static inline ssize_t vhci_put_user(struct vhci_data *data, | |||
180 | return total; | 180 | return total; |
181 | } | 181 | } |
182 | 182 | ||
183 | static loff_t vhci_llseek(struct file *file, loff_t offset, int origin) | ||
184 | { | ||
185 | return -ESPIPE; | ||
186 | } | ||
187 | |||
188 | static ssize_t vhci_read(struct file *file, | 183 | static ssize_t vhci_read(struct file *file, |
189 | char __user *buf, size_t count, loff_t *pos) | 184 | char __user *buf, size_t count, loff_t *pos) |
190 | { | 185 | { |
@@ -334,7 +329,6 @@ static int vhci_fasync(int fd, struct file *file, int on) | |||
334 | 329 | ||
335 | static const struct file_operations vhci_fops = { | 330 | static const struct file_operations vhci_fops = { |
336 | .owner = THIS_MODULE, | 331 | .owner = THIS_MODULE, |
337 | .llseek = vhci_llseek, | ||
338 | .read = vhci_read, | 332 | .read = vhci_read, |
339 | .write = vhci_write, | 333 | .write = vhci_write, |
340 | .poll = vhci_poll, | 334 | .poll = vhci_poll, |