From: <sean.wang@mediatek.com>
To: <marcel@holtmann.org>, <johan.hedberg@gmail.com>
Cc: <sean.wang@mediatek.com>, <Soul.Huang@mediatek.com>,
<YN.Chen@mediatek.com>, <Leon.Yen@mediatek.com>,
<Eric-SY.Chang@mediatek.com>, <Deren.Wu@mediatek.com>,
<km.lin@mediatek.com>, <robin.chiu@mediatek.com>,
<Eddie.Chen@mediatek.com>, <ch.yeh@mediatek.com>,
<posh.sun@mediatek.com>, <ted.huang@mediatek.com>,
<Stella.Chang@mediatek.com>, <Tom.Chou@mediatek.com>,
<steve.lee@mediatek.com>, <jsiuda@google.com>,
<frankgor@google.com>, <abhishekpandit@google.com>,
<michaelfsun@google.com>, <mcchou@chromium.org>,
<shawnku@google.com>, <linux-bluetooth@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
"Jing Cai" <jing.cai@mediatek.com>
Subject: [PATCH v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend
Date: Thu, 14 Jul 2022 04:00:20 +0800 [thread overview]
Message-ID: <3f1ee6737f092ae6312a7ae6079d341b81c791a5.1657670957.git.objelf@gmail.com> (raw)
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
next reply other threads:[~2022-07-13 20:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 20:00 sean.wang [this message]
2022-07-13 21:06 ` [v2] Bluetooth: btusb: mediatek: fix shutdown failure during runtime suspend bluez.test.bot
2022-07-20 16:32 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f1ee6737f092ae6312a7ae6079d341b81c791a5.1657670957.git.objelf@gmail.com \
--to=sean.wang@mediatek.com \
--cc=Deren.Wu@mediatek.com \
--cc=Eddie.Chen@mediatek.com \
--cc=Eric-SY.Chang@mediatek.com \
--cc=Leon.Yen@mediatek.com \
--cc=Soul.Huang@mediatek.com \
--cc=Stella.Chang@mediatek.com \
--cc=Tom.Chou@mediatek.com \
--cc=YN.Chen@mediatek.com \
--cc=abhishekpandit@google.com \
--cc=ch.yeh@mediatek.com \
--cc=frankgor@google.com \
--cc=jing.cai@mediatek.com \
--cc=johan.hedberg@gmail.com \
--cc=jsiuda@google.com \
--cc=km.lin@mediatek.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=marcel@holtmann.org \
--cc=mcchou@chromium.org \
--cc=michaelfsun@google.com \
--cc=posh.sun@mediatek.com \
--cc=robin.chiu@mediatek.com \
--cc=shawnku@google.com \
--cc=steve.lee@mediatek.com \
--cc=ted.huang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).