diff options
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_conn.c | 3 | ||||
-rw-r--r-- | net/bluetooth/hci_debugfs.c | 12 | ||||
-rw-r--r-- | net/bluetooth/hci_debugfs.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 5 |
5 files changed, 22 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index f20f6bd668bd..3e7e5110f298 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -440,6 +440,7 @@ struct hci_conn { | |||
440 | struct delayed_work le_conn_timeout; | 440 | struct delayed_work le_conn_timeout; |
441 | 441 | ||
442 | struct device dev; | 442 | struct device dev; |
443 | struct dentry *debugfs; | ||
443 | 444 | ||
444 | struct hci_dev *hdev; | 445 | struct hci_dev *hdev; |
445 | void *l2cap_data; | 446 | void *l2cap_data; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 4405fb352c70..75240aaca101 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -25,6 +25,7 @@ | |||
25 | /* Bluetooth HCI connection handling. */ | 25 | /* Bluetooth HCI connection handling. */ |
26 | 26 | ||
27 | #include <linux/export.h> | 27 | #include <linux/export.h> |
28 | #include <linux/debugfs.h> | ||
28 | 29 | ||
29 | #include <net/bluetooth/bluetooth.h> | 30 | #include <net/bluetooth/bluetooth.h> |
30 | #include <net/bluetooth/hci_core.h> | 31 | #include <net/bluetooth/hci_core.h> |
@@ -547,6 +548,8 @@ int hci_conn_del(struct hci_conn *conn) | |||
547 | 548 | ||
548 | hci_conn_del_sysfs(conn); | 549 | hci_conn_del_sysfs(conn); |
549 | 550 | ||
551 | debugfs_remove_recursive(conn->debugfs); | ||
552 | |||
550 | if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags)) | 553 | if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags)) |
551 | hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type); | 554 | hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type); |
552 | 555 | ||
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c index a7a0db03b0b8..ee33ce88d3d8 100644 --- a/net/bluetooth/hci_debugfs.c +++ b/net/bluetooth/hci_debugfs.c | |||
@@ -1062,3 +1062,15 @@ void hci_debugfs_create_le(struct hci_dev *hdev) | |||
1062 | debugfs_create_u16("discov_interleaved_timeout", 0644, hdev->debugfs, | 1062 | debugfs_create_u16("discov_interleaved_timeout", 0644, hdev->debugfs, |
1063 | &hdev->discov_interleaved_timeout); | 1063 | &hdev->discov_interleaved_timeout); |
1064 | } | 1064 | } |
1065 | |||
1066 | void hci_debugfs_create_conn(struct hci_conn *conn) | ||
1067 | { | ||
1068 | struct hci_dev *hdev = conn->hdev; | ||
1069 | char name[6]; | ||
1070 | |||
1071 | if (IS_ERR_OR_NULL(hdev->debugfs)) | ||
1072 | return; | ||
1073 | |||
1074 | snprintf(name, sizeof(name), "%u", conn->handle); | ||
1075 | conn->debugfs = debugfs_create_dir(name, hdev->debugfs); | ||
1076 | } | ||
diff --git a/net/bluetooth/hci_debugfs.h b/net/bluetooth/hci_debugfs.h index f191100b50c5..fb68efe083c5 100644 --- a/net/bluetooth/hci_debugfs.h +++ b/net/bluetooth/hci_debugfs.h | |||
@@ -23,3 +23,4 @@ | |||
23 | void hci_debugfs_create_common(struct hci_dev *hdev); | 23 | void hci_debugfs_create_common(struct hci_dev *hdev); |
24 | void hci_debugfs_create_bredr(struct hci_dev *hdev); | 24 | void hci_debugfs_create_bredr(struct hci_dev *hdev); |
25 | void hci_debugfs_create_le(struct hci_dev *hdev); | 25 | void hci_debugfs_create_le(struct hci_dev *hdev); |
26 | void hci_debugfs_create_conn(struct hci_conn *conn); | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a3055e90a5bb..eed44c643c0c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <net/bluetooth/mgmt.h> | 31 | #include <net/bluetooth/mgmt.h> |
32 | 32 | ||
33 | #include "hci_request.h" | 33 | #include "hci_request.h" |
34 | #include "hci_debugfs.h" | ||
34 | #include "a2mp.h" | 35 | #include "a2mp.h" |
35 | #include "amp.h" | 36 | #include "amp.h" |
36 | #include "smp.h" | 37 | #include "smp.h" |
@@ -2162,6 +2163,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2162 | } else | 2163 | } else |
2163 | conn->state = BT_CONNECTED; | 2164 | conn->state = BT_CONNECTED; |
2164 | 2165 | ||
2166 | hci_debugfs_create_conn(conn); | ||
2165 | hci_conn_add_sysfs(conn); | 2167 | hci_conn_add_sysfs(conn); |
2166 | 2168 | ||
2167 | if (test_bit(HCI_AUTH, &hdev->flags)) | 2169 | if (test_bit(HCI_AUTH, &hdev->flags)) |
@@ -3638,6 +3640,7 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, | |||
3638 | conn->handle = __le16_to_cpu(ev->handle); | 3640 | conn->handle = __le16_to_cpu(ev->handle); |
3639 | conn->state = BT_CONNECTED; | 3641 | conn->state = BT_CONNECTED; |
3640 | 3642 | ||
3643 | hci_debugfs_create_conn(conn); | ||
3641 | hci_conn_add_sysfs(conn); | 3644 | hci_conn_add_sysfs(conn); |
3642 | break; | 3645 | break; |
3643 | 3646 | ||
@@ -4178,6 +4181,7 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev, | |||
4178 | hcon->disc_timeout = HCI_DISCONN_TIMEOUT; | 4181 | hcon->disc_timeout = HCI_DISCONN_TIMEOUT; |
4179 | hci_conn_drop(hcon); | 4182 | hci_conn_drop(hcon); |
4180 | 4183 | ||
4184 | hci_debugfs_create_conn(hcon); | ||
4181 | hci_conn_add_sysfs(hcon); | 4185 | hci_conn_add_sysfs(hcon); |
4182 | 4186 | ||
4183 | amp_physical_cfm(bredr_hcon, hcon); | 4187 | amp_physical_cfm(bredr_hcon, hcon); |
@@ -4384,6 +4388,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
4384 | conn->le_conn_latency = le16_to_cpu(ev->latency); | 4388 | conn->le_conn_latency = le16_to_cpu(ev->latency); |
4385 | conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout); | 4389 | conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout); |
4386 | 4390 | ||
4391 | hci_debugfs_create_conn(conn); | ||
4387 | hci_conn_add_sysfs(conn); | 4392 | hci_conn_add_sysfs(conn); |
4388 | 4393 | ||
4389 | hci_proto_connect_cfm(conn, ev->status); | 4394 | hci_proto_connect_cfm(conn, ev->status); |