summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-14 22:13:51 +0400
committerMarcel Holtmann <marcel@holtmann.org>2008-07-14 22:13:51 +0400
commit7d0db0a373195385a2e0b19d1f5e4b186fdcffac (patch)
tree4e82fafd39eb0a32bfb0a340302dd0baf15410e0 /net/bluetooth/hci_event.c
parent43cbeee9f9b26300275e4e2d55ed1607f8c5f760 (diff)
downloadlinux-7d0db0a373195385a2e0b19d1f5e4b186fdcffac.tar.xz
[Bluetooth] Use a more unique bus name for connections
When attaching Bluetooth low-level connections to the bus, the bus name is constructed from the remote address since at that time the connection handle is not assigned yet. This has worked so far, but also caused a lot of troubles. It is better to postpone the creation of the sysfs entry to the time when the connection actually has been established and then use its connection handle as unique identifier. This also fixes the case where two different adapters try to connect to the same remote device. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 64668e2656a5..0e3db289f4be 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -874,6 +874,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
} else
conn->state = BT_CONNECTED;
+ hci_conn_add_sysfs(conn);
+
if (test_bit(HCI_AUTH, &hdev->flags))
conn->link_mode |= HCI_LM_AUTH;
@@ -1011,6 +1013,9 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
if (conn) {
conn->state = BT_CLOSED;
+
+ hci_conn_del_sysfs(conn);
+
hci_proto_disconn_ind(conn, ev->reason);
hci_conn_del(conn);
}
@@ -1643,6 +1648,8 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu
if (!ev->status) {
conn->handle = __le16_to_cpu(ev->handle);
conn->state = BT_CONNECTED;
+
+ hci_conn_add_sysfs(conn);
} else
conn->state = BT_CLOSED;