From: sean.wang@kernel.org
To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
Sean Wang <sean.wang@mediatek.com>,
Yake Yang <yake.yang@mediatek.com>
Subject: [PATCH] Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received
Date: Tue, 11 Mar 2025 16:16:30 -0700 [thread overview]
Message-ID: <20250311231630.35255-1-sean.wang@kernel.org> (raw)
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
next reply other threads:[~2025-03-11 23:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 23:16 sean.wang [this message]
2025-03-11 23:53 ` Bluetooth: btmtk: delay usb_autopm_put_interface until WMT event received bluez.test.bot
2025-03-12 6:39 ` [PATCH] " Paul Menzel
2025-03-13 2:03 ` 回复: " Yake Yang (杨亚克)
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=20250311231630.35255-1-sean.wang@kernel.org \
--to=sean.wang@kernel.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=sean.wang@mediatek.com \
--cc=yake.yang@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 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.