* [PATCH] Bluetooth: Fix basic debugfs entries for unconfigured controllers
@ 2015-10-08 10:35 Marcel Holtmann
2015-10-08 12:34 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2015-10-08 10:35 UTC (permalink / raw)
To: linux-bluetooth
When the controller is unconfigured (for example it does not have a
valid Bluetooth address), then the basic debugfs entries for dut_mode
and vendor_diag are not creates. Ensure they are created in __hci_init
and also __hci_unconf_init functions. One of them is called during setup
stage of a new controller.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/hci_core.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b2095ca8472e..d2b3dd32d6cf 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -184,6 +184,16 @@ static const struct file_operations vendor_diag_fops = {
.llseek = default_llseek,
};
+static void hci_debugfs_create_basic(struct hci_dev *hdev)
+{
+ debugfs_create_file("dut_mode", 0644, hdev->debugfs, hdev,
+ &dut_mode_fops);
+
+ if (hdev->set_diag)
+ debugfs_create_file("vendor_diag", 0644, hdev->debugfs, hdev,
+ &vendor_diag_fops);
+}
+
/* ---- HCI requests ---- */
static void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
@@ -900,20 +910,8 @@ static int __hci_init(struct hci_dev *hdev)
if (err < 0)
return err;
- if (hci_dev_test_flag(hdev, HCI_SETUP)) {
- /* The Device Under Test (DUT) mode is special and available
- * for all controller types. So just create it early on.
- */
- debugfs_create_file("dut_mode", 0644, hdev->debugfs, hdev,
- &dut_mode_fops);
-
- /* When the driver supports the set_diag callback, then
- * expose an entry to modify the vendor diagnostic setting.
- */
- if (hdev->set_diag)
- debugfs_create_file("vendor_diag", 0644, hdev->debugfs,
- hdev, &vendor_diag_fops);
- }
+ if (hci_dev_test_flag(hdev, HCI_SETUP))
+ hci_debugfs_create_basic(hdev);
err = __hci_req_sync(hdev, hci_init2_req, 0, HCI_INIT_TIMEOUT);
if (err < 0)
@@ -990,6 +988,9 @@ static int __hci_unconf_init(struct hci_dev *hdev)
if (err < 0)
return err;
+ if (hci_dev_test_flag(hdev, HCI_SETUP))
+ hci_debugfs_create_basic(hdev);
+
return 0;
}
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: Fix basic debugfs entries for unconfigured controllers
2015-10-08 10:35 [PATCH] Bluetooth: Fix basic debugfs entries for unconfigured controllers Marcel Holtmann
@ 2015-10-08 12:34 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2015-10-08 12:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Thu, Oct 08, 2015, Marcel Holtmann wrote:
> When the controller is unconfigured (for example it does not have a
> valid Bluetooth address), then the basic debugfs entries for dut_mode
> and vendor_diag are not creates. Ensure they are created in __hci_init
> and also __hci_unconf_init functions. One of them is called during setup
> stage of a new controller.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/hci_core.c | 29 +++++++++++++++--------------
> 1 file changed, 15 insertions(+), 14 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-08 12:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 10:35 [PATCH] Bluetooth: Fix basic debugfs entries for unconfigured controllers Marcel Holtmann
2015-10-08 12:34 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).