aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-04-02 06:34:31 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-04-04 12:16:04 -0400
commitb6ddb638235d90ed67af9af40e63880fd66a1939 (patch)
treeacb90fd3ac15d2e879a2f1df5a5992b9c3d40afd /net
parent1687dfc3dcecd7f22f60461b562b9ae3171eb93e (diff)
Bluetooth: Track received events in hdev
This patch adds tracking of received HCI events to the hci_dev struct. This is necessary so that a subsequent patch can implement a function for sending a single command synchronously and returning the resulting command complete parameters in the function return value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c3
-rw-r--r--net/bluetooth/hci_event.c12
2 files changed, 15 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index a199d631e31c..7c323bd112ff 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1136,6 +1136,9 @@ static int hci_dev_do_close(struct hci_dev *hdev)
1136 hdev->sent_cmd = NULL; 1136 hdev->sent_cmd = NULL;
1137 } 1137 }
1138 1138
1139 kfree_skb(hdev->recv_evt);
1140 hdev->recv_evt = NULL;
1141
1139 /* After this point our queues are empty 1142 /* After this point our queues are empty
1140 * and no tasks are scheduled. */ 1143 * and no tasks are scheduled. */
1141 hdev->close(hdev); 1144 hdev->close(hdev);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 7e7fbca59439..ed0efb7255b0 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3699,6 +3699,18 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
3699 struct hci_event_hdr *hdr = (void *) skb->data; 3699 struct hci_event_hdr *hdr = (void *) skb->data;
3700 __u8 event = hdr->evt; 3700 __u8 event = hdr->evt;
3701 3701
3702 hci_dev_lock(hdev);
3703
3704 /* Received events are (currently) only needed when a request is
3705 * ongoing so avoid unnecessary memory allocation.
3706 */
3707 if (hdev->req_status == HCI_REQ_PEND) {
3708 kfree_skb(hdev->recv_evt);
3709 hdev->recv_evt = skb_clone(skb, GFP_KERNEL);
3710 }
3711
3712 hci_dev_unlock(hdev);
3713
3702 skb_pull(skb, HCI_EVENT_HDR_SIZE); 3714 skb_pull(skb, HCI_EVENT_HDR_SIZE);
3703 3715
3704 switch (event) { 3716 switch (event) {