diff mbox series

[v2] Bluetooth: qca: Fix QCA6390 enable failure after reboot or disable

Message ID 1713175927-13093-1-git-send-email-quic_zijuhu@quicinc.com (mailing list archive)
State Superseded
Headers show
Series [v2] Bluetooth: qca: Fix QCA6390 enable failure after reboot or disable | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: drivers/bluetooth/hci_qca.c:2362 error: drivers/bluetooth/hci_qca.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

quic_zijuhu April 15, 2024, 10:12 a.m. UTC
Fix QCA6390 enable failure after reboot or disable.

Fixes: 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
Changes v1 -> v2
 Revert commit 56d074d26c58

 drivers/bluetooth/hci_qca.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

bluez.test.bot@gmail.com April 15, 2024, 10:36 a.m. UTC | #1
This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: drivers/bluetooth/hci_qca.c:2362
error: drivers/bluetooth/hci_qca.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index b61ca9828284..d8a6d6b1bbea 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2362,7 +2362,7 @@  static int qca_serdev_probe(struct serdev_device *serdev)
 			BT_INFO("%s: Got enable gpio(%d) ", __func__, desc_to_gpio(qcadev->bt_en));
 		else
 			BT_INFO("%s: qcadev->bt_en(nullptr)", __func__);
-		if (IS_ERR(qcadev->bt_en) &&
+		if (IS_ERR_OR_NULL(qcadev->bt_en) &&
 		    (data->soc_type == QCA_WCN6750 ||
 		     data->soc_type == QCA_WCN6855)) {
 			dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
@@ -2378,7 +2378,7 @@  static int qca_serdev_probe(struct serdev_device *serdev)
 				desc_to_gpio(qcadev->sw_ctrl));
 		else
 			BT_INFO("%s: qcadev->sw_ctrl(nullptr)", __func__);
-		if (IS_ERR(qcadev->sw_ctrl) &&
+		if (IS_ERR_OR_NULL(qcadev->sw_ctrl) &&
 		    (data->soc_type == QCA_WCN6750 ||
 		     data->soc_type == QCA_WCN6855 ||
 		     data->soc_type == QCA_WCN7850))
@@ -2404,7 +2404,7 @@  static int qca_serdev_probe(struct serdev_device *serdev)
 	default:
 		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
 							GPIOD_OUT_LOW);
-		if (IS_ERR(qcadev->bt_en))
+		if (IS_ERR_OR_NULL(qcadev->bt_en))
 			BT_ERR("%s: default Get enable gpio ERROR", __func__);
 		else if (qcadev->bt_en)
 			BT_INFO("%s: default Got enable gpio(%d) ",
@@ -2499,14 +2499,19 @@  static void qca_serdev_shutdown(struct device *dev)
 	struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
 	struct hci_uart *hu = &qcadev->serdev_hu;
 	struct hci_dev *hdev = hu->hdev;
-	struct qca_data *qca = hu->priv;
 	const u8 ibs_wake_cmd[] = { 0xFD };
 	const u8 edl_reset_soc_cmd[] = { 0x01, 0x00, 0xFC, 0x01, 0x05 };
 
 	if (qcadev->btsoc_type == QCA_QCA6390) {
-		if (test_bit(QCA_BT_OFF, &qca->flags) ||
-		    !test_bit(HCI_RUNNING, &hdev->flags))
+		if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) {
+			BT_INFO("%s: Don't need to send EDL_RESET_REQ", __func__);
+			return;
+		}
+
+		if (hci_dev_test_flag(hdev, HCI_SETUP)) {
+			BT_INFO("%s: Don't send EDL_RESET_REQ due to NOT setup ", __func__);
 			return;
+		}
 
 		BT_INFO("%s: Start to send EDL_RESET_REQ", __func__);
 		serdev_device_write_flush(serdev);