summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_sysfs.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_sysfs.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_sysfs.c')
-rw-r--r--net/bluetooth/hci_sysfs.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index a18871e01582..844ca5f1b2d4 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -311,7 +311,6 @@ static void add_conn(struct work_struct *work)
void hci_conn_add_sysfs(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
- bdaddr_t *ba = &conn->dst;
BT_DBG("conn %p", conn);
@@ -320,11 +319,8 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
conn->dev.release = bt_release;
- snprintf(conn->dev.bus_id, BUS_ID_SIZE,
- "%s%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
- conn->type == ACL_LINK ? "acl" : "sco",
- ba->b[5], ba->b[4], ba->b[3],
- ba->b[2], ba->b[1], ba->b[0]);
+ snprintf(conn->dev.bus_id, BUS_ID_SIZE, "%s:%d",
+ hdev->name, conn->handle);
dev_set_drvdata(&conn->dev, conn);