Commit 4da385f7 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Marcel Holtmann
Browse files

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: 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 e2a119cd
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -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) {
		ret = -ETIMEDOUT;
		goto error;
	}

	if (ret > 0) {
	qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
	return 0;
	}

	if (ret == 0)
		ret = -ETIMEDOUT;

error:
	clear_bit(QCA_SUSPENDING, &qca->flags);