diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-10-10 10:38:28 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-10-11 02:33:05 -0400 |
commit | 42c4e53e7ac3d4069105e852d1ee24e6ee9e57b8 (patch) | |
tree | 13ce2100ae7162011bbc82bb01991f5fe8607163 /net/bluetooth/hci_conn.c | |
parent | 53502d69be49e3dd5bc95ab0f2deeaea260bd617 (diff) |
Bluetooth: AMP: Add handle to hci_chan structure
hci_chan will be identified by handle used in logical link creation
process. This handle is used in AMP ACL-U packet handle field.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 64875794dd9b..fe646211c61f 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -989,3 +989,35 @@ void hci_chan_list_flush(struct hci_conn *conn) | |||
989 | list_for_each_entry_safe(chan, n, &conn->chan_list, list) | 989 | list_for_each_entry_safe(chan, n, &conn->chan_list, list) |
990 | hci_chan_del(chan); | 990 | hci_chan_del(chan); |
991 | } | 991 | } |
992 | |||
993 | static struct hci_chan *__hci_chan_lookup_handle(struct hci_conn *hcon, | ||
994 | __u16 handle) | ||
995 | { | ||
996 | struct hci_chan *hchan; | ||
997 | |||
998 | list_for_each_entry(hchan, &hcon->chan_list, list) { | ||
999 | if (hchan->handle == handle) | ||
1000 | return hchan; | ||
1001 | } | ||
1002 | |||
1003 | return NULL; | ||
1004 | } | ||
1005 | |||
1006 | struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle) | ||
1007 | { | ||
1008 | struct hci_conn_hash *h = &hdev->conn_hash; | ||
1009 | struct hci_conn *hcon; | ||
1010 | struct hci_chan *hchan = NULL; | ||
1011 | |||
1012 | rcu_read_lock(); | ||
1013 | |||
1014 | list_for_each_entry_rcu(hcon, &h->list, list) { | ||
1015 | hchan = __hci_chan_lookup_handle(hcon, handle); | ||
1016 | if (hchan) | ||
1017 | break; | ||
1018 | } | ||
1019 | |||
1020 | rcu_read_unlock(); | ||
1021 | |||
1022 | return hchan; | ||
1023 | } | ||