Skip to contentSkip to conversation

Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received

PATCH In review [email protected] 2 participants 2 messages Mar 19, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received

From: Sean Wang <[email protected]>

Delay calling usb_autopm_put_interface until the WMT event response is received to ensure proper synchronization and prevent premature power management actions.

No public link for the reported-by tag available, the report was sent via private email.

---
v2: add a reported-by tag and mention it was reported in private email.

---
 drivers/bluetooth/btmtk.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/bluetooth/btmtk.c +7 -8
index 68846c5bd4f7..01832bc6a259 100644
@@ -620,17 +620,14 @@ static int btmtk_usb_hci_wmt_sync(struct hci_dev *hdev,
 
 	if (err < 0) {
 		clear_bit(BTMTK_TX_WAIT_VND_EVT, &data->flags);
-		usb_autopm_put_interface(data->intf);
-		goto err_free_wc;
+		goto err_pm_put;
 	}
 
 	/* Submit control IN URB on demand to process the WMT event */
 	err = btmtk_usb_submit_wmt_recv_urb(hdev);
 
-	usb_autopm_put_interface(data->intf);
-
 	if (err < 0)
-		goto err_free_wc;
+		goto err_pm_put;
 
 	/* The vendor specific WMT commands are all answered by a vendor
 	 * specific event and will have the Command Status or Command
@@ -646,18 +643,18 @@ static int btmtk_usb_hci_wmt_sync(struct hci_dev *hdev,
 	if (err == -EINTR) {
 		bt_dev_err(hdev, "Execution of wmt command interrupted");
 		clear_bit(BTMTK_TX_WAIT_VND_EVT, &data->flags);
-		goto err_free_wc;
+		goto err_pm_put;
 	}
 
 	if (err) {
 		bt_dev_err(hdev, "Execution of wmt command timed out");
 		clear_bit(BTMTK_TX_WAIT_VND_EVT, &data->flags);
 		err = -ETIMEDOUT;
-		goto err_free_wc;
+		goto err_pm_put;
 	}
 
 	if (data->evt_skb == NULL)
-		goto err_free_wc;
+		goto err_pm_put;
 
 	/* Parse and handle the return WMT event */
 	wmt_evt = (struct btmtk_hci_wmt_evt *)data->evt_skb->data;
@@ -700,6 +697,8 @@ static int btmtk_usb_hci_wmt_sync(struct hci_dev *hdev,
 err_free_skb:
 	kfree_skb(data->evt_skb);
 	data->evt_skb = NULL;
+err_pm_put:
+	usb_autopm_put_interface(data->intf);
 err_free_wc:
 	kfree(wc);
 	return err;
Signature · 1 line
2.25.1
#1 lore raw

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=945747

---Test result---

Test Summary:

CheckPatch                    PENDING   0.28 seconds
GitLint                       PENDING   0.20 seconds
SubjectPrefix                 PASS      0.34 seconds
BuildKernel                   PASS      23.81 seconds
CheckAllWarning               PASS      26.31 seconds
CheckSparse                   PASS      30.18 seconds
BuildKernel32                 PASS      23.65 seconds
TestRunnerSetup               PASS      426.61 seconds
TestRunner_l2cap-tester       FAIL      23.55 seconds
TestRunner_iso-tester         FAIL      36.71 seconds
TestRunner_bnep-tester        PASS      4.68 seconds
TestRunner_mgmt-tester        PASS      120.49 seconds
TestRunner_rfcomm-tester      PASS      7.72 seconds
TestRunner_sco-tester         FAIL      15.25 seconds
TestRunner_ioctl-tester       PASS      8.07 seconds
TestRunner_mesh-tester        PASS      5.86 seconds
TestRunner_smp-tester         PASS      7.17 seconds
TestRunner_userchan-tester    PASS      4.88 seconds
IncrementalBuild              PENDING   0.47 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner Output:
Total: 62, Passed: 59 (95.2%), Failed: 3, Not Run: 0

Failed Test Cases

L2CAP BR/EDR Client - TX Timestamping                Failed       0.122 seconds
L2CAP BR/EDR Client - Stream TX Timestamping         Failed       0.110 seconds
L2CAP LE Client - TX Timestamping                    Failed       0.109 seconds

##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 124, Passed: 121 (97.6%), Failed: 2, Not Run: 1

Failed Test Cases

ISO Send - TX Timestamping                           Failed       0.205 seconds
ISO Send - TX CMSG Timestamping                      Timed out    1.847 seconds

##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner Output:
Total: 20, Passed: 18 (90.0%), Failed: 2, Not Run: 0

Failed Test Cases

SCO CVSD Send - TX Timestamping                      Failed       0.166 seconds
SCO CVSD Send No Flowctl - TX Timestamping           Timed out    2.404 seconds

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth