linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received
@ 2025-03-11 23:16 sean.wang
  2025-03-11 23:53 ` bluez.test.bot
  2025-03-12  6:39 ` [PATCH] " Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: sean.wang @ 2025-03-11 23:16 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-mediatek, linux-kernel, Sean Wang,
	Yake Yang

From: Sean Wang <sean.wang@mediatek.com>

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

Co-developed-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btmtk.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 68846c5bd4f7..01832bc6a259 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received
  2025-03-11 23:16 [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received sean.wang
@ 2025-03-11 23:53 ` bluez.test.bot
  2025-03-12  6:39 ` [PATCH] " Paul Menzel
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-03-11 23:53 UTC (permalink / raw)
  To: linux-bluetooth, sean.wang

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PENDING   0.27 seconds
GitLint                       PENDING   0.20 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      23.82 seconds
CheckAllWarning               PASS      26.19 seconds
CheckSparse                   PASS      29.48 seconds
BuildKernel32                 PASS      23.39 seconds
TestRunnerSetup               PASS      430.18 seconds
TestRunner_l2cap-tester       PASS      20.38 seconds
TestRunner_iso-tester         PASS      32.54 seconds
TestRunner_bnep-tester        PASS      4.69 seconds
TestRunner_mgmt-tester        FAIL      122.41 seconds
TestRunner_rfcomm-tester      PASS      7.81 seconds
TestRunner_sco-tester         PASS      16.29 seconds
TestRunner_ioctl-tester       PASS      8.22 seconds
TestRunner_mesh-tester        PASS      6.04 seconds
TestRunner_smp-tester         PASS      7.14 seconds
TestRunner_userchan-tester    PASS      4.91 seconds
IncrementalBuild              PENDING   0.51 seconds

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

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

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
LL Privacy - Set Flags 3 (2 Devices to RL)           Failed       0.194 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received
  2025-03-11 23:16 [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received sean.wang
  2025-03-11 23:53 ` bluez.test.bot
@ 2025-03-12  6:39 ` Paul Menzel
  2025-03-13  2:03   ` 回复: " Yake Yang (杨亚克)
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2025-03-12  6:39 UTC (permalink / raw)
  To: Sean Wang, Yake Yang
  Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth,
	linux-mediatek, linux-kernel

Dear Sean, dear Yake,


Thank you for the patch.

Am 12.03.25 um 00:16 schrieb sean.wang@kernel.org:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Delay calling usb_autopm_put_interface until the WMT event response is
> received to ensure proper synchronization and prevent premature power
> management actions.

Do you have a reproducer? It’d be great if you could add that to the 
commit message.


Kind regards,

Paul


> Co-developed-by: Yake Yang <yake.yang@mediatek.com>
> Signed-off-by: Yake Yang <yake.yang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>   drivers/bluetooth/btmtk.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
> index 68846c5bd4f7..01832bc6a259 100644
> --- a/drivers/bluetooth/btmtk.c
> +++ b/drivers/bluetooth/btmtk.c
> @@ -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;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received
  2025-03-12  6:39 ` [PATCH] " Paul Menzel
@ 2025-03-13  2:03   ` Yake Yang (杨亚克)
  0 siblings, 0 replies; 4+ messages in thread
From: Yake Yang (杨亚克) @ 2025-03-13  2:03 UTC (permalink / raw)
  To: Paul Menzel, Sean Wang, Wentao Guan
  Cc: marcel@holtmann.org, johan.hedberg@gmail.com,
	luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org

Dear Paul , Sean,
Wentao (guanwentao@uniontech.com) is the reproducer .
Thanks!

-----邮件原件-----
发件人: Paul Menzel <pmenzel@molgen.mpg.de> 
发送时间: 2025年3月12日 14:40
收件人: Sean Wang <Sean.Wang@mediatek.com>; Yake Yang (杨亚克) <yake.yang@mediatek.com>
抄送: marcel@holtmann.org; johan.hedberg@gmail.com; luiz.dentz@gmail.com; linux-bluetooth@vger.kernel.org; linux-mediatek@lists.infradead.org; linux-kernel@vger.kernel.org
主题: Re: [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received


External email : Please do not click links or open attachments until you have verified the sender or the content.


Dear Sean, dear Yake,


Thank you for the patch.

Am 12.03.25 um 00:16 schrieb sean.wang@kernel.org:
> From: Sean Wang <sean.wang@mediatek.com>
>
> Delay calling usb_autopm_put_interface until the WMT event response is 
> received to ensure proper synchronization and prevent premature power 
> management actions.

Do you have a reproducer? It’d be great if you could add that to the commit message.


Kind regards,

Paul


> Co-developed-by: Yake Yang <yake.yang@mediatek.com>
> Signed-off-by: Yake Yang <yake.yang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>   drivers/bluetooth/btmtk.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c 
> index 68846c5bd4f7..01832bc6a259 100644
> --- a/drivers/bluetooth/btmtk.c
> +++ b/drivers/bluetooth/btmtk.c
> @@ -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;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-13  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 23:16 [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received sean.wang
2025-03-11 23:53 ` bluez.test.bot
2025-03-12  6:39 ` [PATCH] " Paul Menzel
2025-03-13  2:03   ` 回复: " Yake Yang (杨亚克)

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).