2023-05-09 00:24:38

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH] Bluetooth: btintel: Cleanup code related to btintel_set_quality_report

From: Luiz Augusto von Dentz <[email protected]>

btintel_set_quality_report shall only be registered if debug features
related to it are registered so it is moved under
btintel_register_devcoredump_support since that already performs the
necessary checks and doing this avoid having to call
btintel_read_debug_features everytime set_quality_report is toggled.

Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
drivers/bluetooth/btintel.c | 50 +++++++------------------------------
1 file changed, 9 insertions(+), 41 deletions(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index d9349ba48281..bf80ae913a7c 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1282,7 +1282,7 @@ static int btintel_read_debug_features(struct hci_dev *hdev,
skb = __hci_cmd_sync(hdev, 0xfca6, sizeof(page_no), &page_no,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
- bt_dev_err(hdev, "Reading supported features failed (%ld)",
+ bt_dev_dbg(hdev, "Reading supported features failed (%ld)",
PTR_ERR(skb));
return PTR_ERR(skb);
}
@@ -1360,8 +1360,7 @@ static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data
return AE_CTRL_TERMINATE;
}

-static int btintel_set_debug_features(struct hci_dev *hdev,
- const struct intel_debug_features *features)
+static int btintel_set_debug_features(struct hci_dev *hdev)
{
u8 mask[11] = { 0x0a, 0x92, 0x02, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
@@ -1369,16 +1368,6 @@ static int btintel_set_debug_features(struct hci_dev *hdev,
u8 trace_enable = 0x02;
struct sk_buff *skb;

- if (!features) {
- bt_dev_warn(hdev, "Debug features not read");
- return -EINVAL;
- }
-
- if (!(features->page1[0] & 0x3f)) {
- bt_dev_info(hdev, "Telemetry exception format not supported");
- return 0;
- }
-
skb = __hci_cmd_sync(hdev, 0xfc8b, 11, mask, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Setting Intel telemetry ddc write event mask failed (%ld)",
@@ -1409,24 +1398,13 @@ static int btintel_set_debug_features(struct hci_dev *hdev,
return 0;
}

-static int btintel_reset_debug_features(struct hci_dev *hdev,
- const struct intel_debug_features *features)
+static int btintel_reset_debug_features(struct hci_dev *hdev)
{
u8 mask[11] = { 0x0a, 0x92, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
u8 trace_enable = 0x00;
struct sk_buff *skb;

- if (!features) {
- bt_dev_warn(hdev, "Debug features not read");
- return -EINVAL;
- }
-
- if (!(features->page1[0] & 0x3f)) {
- bt_dev_info(hdev, "Telemetry exception format not supported");
- return 0;
- }
-
/* Should stop the trace before writing ddc event mask. */
skb = __hci_cmd_sync(hdev, 0xfca1, 1, &trace_enable, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
@@ -1452,23 +1430,15 @@ static int btintel_reset_debug_features(struct hci_dev *hdev,

int btintel_set_quality_report(struct hci_dev *hdev, bool enable)
{
- struct intel_debug_features features;
int err;

bt_dev_dbg(hdev, "enable %d", enable);

- /* Read the Intel supported features and if new exception formats
- * supported, need to load the additional DDC config to enable.
- */
- err = btintel_read_debug_features(hdev, &features);
- if (err)
- return err;
-
/* Set or reset the debug features. */
if (enable)
- err = btintel_set_debug_features(hdev, &features);
+ err = btintel_set_debug_features(hdev);
else
- err = btintel_reset_debug_features(hdev, &features);
+ err = btintel_reset_debug_features(hdev);

return err;
}
@@ -1512,16 +1482,17 @@ static int btintel_register_devcoredump_support(struct hci_dev *hdev)
int err;

err = btintel_read_debug_features(hdev, &features);
- if (err) {
- bt_dev_info(hdev, "Error reading debug features");
+ if (err)
return err;
- }

if (!(features.page1[0] & 0x3f)) {
bt_dev_dbg(hdev, "Telemetry exception format not supported");
return -EOPNOTSUPP;
}

+ /* Set up the quality report callback for Intel devices */
+ hdev->set_quality_report = btintel_set_quality_report;
+
hci_devcd_register(hdev, btintel_coredump, btintel_dmp_hdr, NULL);

return err;
@@ -2599,9 +2570,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);

- /* Set up the quality report callback for Intel devices */
- hdev->set_quality_report = btintel_set_quality_report;
-
/* For Legacy device, check the HW platform value and size */
if (skb->len == sizeof(ver) && skb->data[1] == 0x37) {
bt_dev_dbg(hdev, "Read the legacy Intel version information");
--
2.40.0


2023-05-09 01:22:13

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: btintel: Cleanup code related to btintel_set_quality_report

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=745955

---Test result---

Test Summary:
CheckPatch PASS 0.71 seconds
GitLint PASS 0.34 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 32.55 seconds
CheckAllWarning PASS 35.23 seconds
CheckSparse PASS 40.23 seconds
CheckSmatch PASS 110.33 seconds
BuildKernel32 PASS 31.46 seconds
TestRunnerSetup PASS 446.58 seconds
TestRunner_l2cap-tester PASS 17.25 seconds
TestRunner_iso-tester PASS 21.70 seconds
TestRunner_bnep-tester PASS 5.67 seconds
TestRunner_mgmt-tester PASS 117.36 seconds
TestRunner_rfcomm-tester PASS 9.14 seconds
TestRunner_sco-tester PASS 8.39 seconds
TestRunner_ioctl-tester PASS 9.77 seconds
TestRunner_mesh-tester PASS 7.14 seconds
TestRunner_smp-tester PASS 8.21 seconds
TestRunner_userchan-tester PASS 5.95 seconds
IncrementalBuild PASS 30.04 seconds



---
Regards,
Linux Bluetooth