Bluetooth: Add 'dst_type' field to struct hci_conn
authorAndre Guedes <andre.guedes@openbossa.org>
Tue, 31 May 2011 17:20:54 +0000 (14:20 -0300)
committerJaikumar Ganesh <jaikumar@google.com>
Mon, 11 Jul 2011 18:59:15 +0000 (11:59 -0700)
This patch adds a new field (dst_type) to the struct hci_conn which
holds the type of the destination address (bdaddr_t dst). This
approach is needed in order to use the struct hci_conn as an
abstraction of LE connections in HCI Layer. For non-LE this field
is ignored.

This patch also set properly the 'dst_type' field after initializing
LE hci_conn structures.

Change-Id: I1e363bb6de263fdb1fe976a5a16ed5debc9b8c0c
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c

index 90a921cfd23d0d139c581d5d93e62223e3f21d14..924e1720567ef2016107aa55d3532af5e1fdbdb2 100644 (file)
@@ -224,6 +224,7 @@ struct hci_conn {
        spinlock_t      lock;
 
        bdaddr_t        dst;
+       __u8            dst_type;
        __u16           handle;
        __u16           state;
        __u8            mode;
index 0fc8b6f158a5a68372987a936a638f76c9fa51c4..cfc664a99453da2c6a4a617e060faf915cd4ce84 100644 (file)
@@ -1236,10 +1236,12 @@ static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status)
        } else {
                if (!conn) {
                        conn = hci_conn_add(hdev, LE_LINK, 0, &cp->peer_addr);
-                       if (conn)
+                       if (conn) {
+                               conn->dst_type = cp->peer_addr_type;
                                conn->out = 1;
-                       else
+                       } else {
                                BT_ERR("No memory for new connection");
+                       }
                }
        }
 
@@ -2698,6 +2700,8 @@ static inline void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff
                        hci_dev_unlock(hdev);
                        return;
                }
+
+               conn->dst_type = ev->bdaddr_type;
        }
 
        if (ev->status) {