All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend
@ 2022-07-13 20:00 sean.wang
  2022-07-13 21:06 ` [v2] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: sean.wang @ 2022-07-13 20:00 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu,
	km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang,
	Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor,
	abhishekpandit, michaelfsun, mcchou, shawnku, linux-bluetooth,
	linux-mediatek, linux-kernel, Jing Cai

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

Fix the WMT command timed out during Bluetooth was being shutdown while USB
was in runtime suspend state.

Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
Co-developed-by: Jing Cai <jing.cai@mediatek.com>
Signed-off-by: Jing Cai <jing.cai@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btusb.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index fb1a67189412..b1161853c6ab 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2795,10 +2795,15 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
 
 static int btusb_mtk_shutdown(struct hci_dev *hdev)
 {
+	struct btusb_data *data = hci_get_drvdata(hdev);
 	struct btmtk_hci_wmt_params wmt_params;
 	u8 param = 0;
 	int err;
 
+	err = usb_autopm_get_interface(data->intf);
+	if (err < 0)
+		return err;
+
 	/* Disable the device */
 	wmt_params.op = BTMTK_WMT_FUNC_CTRL;
 	wmt_params.flag = 0;
@@ -2807,12 +2812,12 @@ static int btusb_mtk_shutdown(struct hci_dev *hdev)
 	wmt_params.status = NULL;
 
 	err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params);
-	if (err < 0) {
+	if (err < 0)
 		bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
-		return err;
-	}
 
-	return 0;
+	usb_autopm_put_interface(data->intf);
+
+	return err;
 }
 
 static void btusb_mtk_cmd_timeout(struct hci_dev *hdev)
-- 
2.25.1


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

* RE: [v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend
  2022-07-13 20:00 [PATCH v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend sean.wang
@ 2022-07-13 21:06 ` bluez.test.bot
  2022-07-20 16:32   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: bluez.test.bot @ 2022-07-13 21:06 UTC (permalink / raw)
  To: linux-bluetooth, sean.wang

[-- Attachment #1: Type: text/plain, Size: 1100 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=659440

---Test result---

Test Summary:
CheckPatch                    PASS      1.02 seconds
GitLint                       PASS      0.45 seconds
SubjectPrefix                 PASS      0.33 seconds
BuildKernel                   PASS      41.55 seconds
BuildKernel32                 PASS      37.70 seconds
Incremental Build with patchesPASS      49.91 seconds
TestRunner: Setup             PASS      620.74 seconds
TestRunner: l2cap-tester      PASS      20.09 seconds
TestRunner: bnep-tester       PASS      7.29 seconds
TestRunner: mgmt-tester       PASS      122.23 seconds
TestRunner: rfcomm-tester     PASS      11.24 seconds
TestRunner: sco-tester        PASS      10.85 seconds
TestRunner: smp-tester        PASS      11.16 seconds
TestRunner: userchan-tester   PASS      7.91 seconds



---
Regards,
Linux Bluetooth


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

* Re: [v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend
  2022-07-13 21:06 ` [v2] " bluez.test.bot
@ 2022-07-20 16:32   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-07-20 16:32 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org; +Cc: sean.wang

Hi Sean,

On Wed, Jul 13, 2022 at 2:15 PM <bluez.test.bot@gmail.com> wrote:
>
> 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=659440
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      1.02 seconds
> GitLint                       PASS      0.45 seconds
> SubjectPrefix                 PASS      0.33 seconds
> BuildKernel                   PASS      41.55 seconds
> BuildKernel32                 PASS      37.70 seconds
> Incremental Build with patchesPASS      49.91 seconds
> TestRunner: Setup             PASS      620.74 seconds
> TestRunner: l2cap-tester      PASS      20.09 seconds
> TestRunner: bnep-tester       PASS      7.29 seconds
> TestRunner: mgmt-tester       PASS      122.23 seconds
> TestRunner: rfcomm-tester     PASS      11.24 seconds
> TestRunner: sco-tester        PASS      10.85 seconds
> TestRunner: smp-tester        PASS      11.16 seconds
> TestRunner: userchan-tester   PASS      7.91 seconds
>
>
>
> ---
> Regards,
> Linux Bluetooth

Need more context to be able to merge this, why are you using
usb_autopm_get_interface/usb_autopm_put_interface and shouldn't that
be generalized if that is required to handle suspend properly?



-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2022-07-20 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13 20:00 [PATCH v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend sean.wang
2022-07-13 21:06 ` [v2] " bluez.test.bot
2022-07-20 16:32   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.