diff mbox series

Bluetooth: btintel: Cleanup code related to btintel_set_quality_report

Message ID 20230509001455.3111623-1-luiz.dentz@gmail.com (mailing list archive)
State New, archived
Headers show
Series Bluetooth: btintel: Cleanup code related to btintel_set_quality_report | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz May 9, 2023, 12:14 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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 <luiz.von.dentz@intel.com>
---
 drivers/bluetooth/btintel.c | 50 +++++++------------------------------
 1 file changed, 9 insertions(+), 41 deletions(-)

Comments

bluez.test.bot@gmail.com May 9, 2023, 1:13 a.m. UTC | #1
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
diff mbox series

Patch

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");