Commit e2a119cd authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Marcel Holtmann

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: default avatarMatthias Kaehlcke <mka@chromium.org>
Reviewed-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent eff981f6
...@@ -2048,6 +2048,7 @@ static int __maybe_unused qca_suspend(struct device *dev) ...@@ -2048,6 +2048,7 @@ static int __maybe_unused qca_suspend(struct device *dev)
struct hci_uart *hu = &qcadev->serdev_hu; struct hci_uart *hu = &qcadev->serdev_hu;
struct qca_data *qca = hu->priv; struct qca_data *qca = hu->priv;
unsigned long flags; unsigned long flags;
bool tx_pending = false;
int ret = 0; int ret = 0;
u8 cmd; u8 cmd;
...@@ -2081,6 +2082,7 @@ static int __maybe_unused qca_suspend(struct device *dev) ...@@ -2081,6 +2082,7 @@ static int __maybe_unused qca_suspend(struct device *dev)
qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; qca->tx_ibs_state = HCI_IBS_TX_ASLEEP;
qca->ibs_sent_slps++; qca->ibs_sent_slps++;
tx_pending = true;
break; break;
case HCI_IBS_TX_ASLEEP: case HCI_IBS_TX_ASLEEP:
...@@ -2097,8 +2099,10 @@ static int __maybe_unused qca_suspend(struct device *dev) ...@@ -2097,8 +2099,10 @@ static int __maybe_unused qca_suspend(struct device *dev)
if (ret < 0) if (ret < 0)
goto error; goto error;
serdev_device_wait_until_sent(hu->serdev, if (tx_pending) {
msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); 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 /* 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. * to sleep, so that the packet does not wake the system later.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment