summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorMatthias Kaehlcke <mka@chromium.org>2020-06-05 11:46:10 -0700
committerMarcel Holtmann <marcel@holtmann.org>2020-06-08 10:12:53 +0200
commite2a119cd84600f7e2d94d3e8781946b69b6e2376 (patch)
tree65825269cf5d91b32bbefc3570430fb57ed060fb /drivers/bluetooth
parenteff981f6579d5797d68d27afc0eede529ac8778a (diff)
downloadlinux-stable-e2a119cd84600f7e2d94d3e8781946b69b6e2376.tar.gz
linux-stable-e2a119cd84600f7e2d94d3e8781946b69b6e2376.tar.bz2
linux-stable-e2a119cd84600f7e2d94d3e8781946b69b6e2376.zip
Bluetooth: hci_qca: Skip serdev wait when no transfer is pending
qca_suspend() calls serdev_device_wait_until_sent() regardless of whether a transfer is pending. While it does no active harm since the function should return immediately it makes the code more confusing. Add a flag to track whether a transfer is pending and only call serdev_device_wait_until_sent() is needed. Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/hci_qca.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index bce290bbf22d..d073cc20e402 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2048,6 +2048,7 @@ static int __maybe_unused qca_suspend(struct device *dev)
struct hci_uart *hu = &qcadev->serdev_hu;
struct qca_data *qca = hu->priv;
unsigned long flags;
+ bool tx_pending = false;
int ret = 0;
u8 cmd;
@@ -2081,6 +2082,7 @@ static int __maybe_unused qca_suspend(struct device *dev)
qca->tx_ibs_state = HCI_IBS_TX_ASLEEP;
qca->ibs_sent_slps++;
+ tx_pending = true;
break;
case HCI_IBS_TX_ASLEEP:
@@ -2097,8 +2099,10 @@ static int __maybe_unused qca_suspend(struct device *dev)
if (ret < 0)
goto error;
- serdev_device_wait_until_sent(hu->serdev,
- msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
+ if (tx_pending) {
+ serdev_device_wait_until_sent(hu->serdev,
+ msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
+ }
/* Wait for HCI_IBS_SLEEP_IND sent by device to indicate its Tx is going
* to sleep, so that the packet does not wake the system later.