aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorMatthias Kaehlcke <mka@chromium.org>2020-06-05 11:46:11 -0700
committerMarcel Holtmann <marcel@holtmann.org>2020-06-08 10:14:26 +0200
commit4da385f742d485fe3135a2711299cbf28ea24bc9 (patch)
tree51859559da4b3d844db73f5af25cffa05eeb780f /drivers/bluetooth
parentBluetooth: hci_qca: Skip serdev wait when no transfer is pending (diff)
downloadwireguard-linux-4da385f742d485fe3135a2711299cbf28ea24bc9.tar.xz
wireguard-linux-4da385f742d485fe3135a2711299cbf28ea24bc9.zip
Bluetooth: hci_qca: Refactor error handling in qca_suspend()
If waiting for IBS sleep times out jump to the error handler, this is easier to read than multiple 'if' branches and a fall through to the error handler. 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.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index d073cc20e402..28c34a15e029 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2107,18 +2107,16 @@ static int __maybe_unused qca_suspend(struct device *dev)
/* 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.
*/
-
ret = wait_event_interruptible_timeout(qca->suspend_wait_q,
qca->rx_ibs_state == HCI_IBS_RX_ASLEEP,
msecs_to_jiffies(IBS_BTSOC_TX_IDLE_TIMEOUT_MS));
-
- if (ret > 0) {
- qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
- return 0;
+ if (ret == 0) {
+ ret = -ETIMEDOUT;
+ goto error;
}
- if (ret == 0)
- ret = -ETIMEDOUT;
+ qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
+ return 0;
error:
clear_bit(QCA_SUSPENDING, &qca->flags);