[PATCH v1] Bluetooth: qca: Correct property enable-gpios handling logic for WCN6750 and WCN6855

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Commit 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL()
with gpiod_get_optional()") has wrong logic for below case:

property enable-gpios is not configured for WCN6750 and WCN6855

Function devm_gpiod_get_optional(...,"enable",...) returns NULL for above
case, we normaly need to treat it as success case as the commit argued
but the property enable-gpios is marked as required by the binding spec
so we can't treat it as success case any more since it is a required
property but not configured by user.

Fix by reverting the commit's impact for WCN6750 and WCN6855, error
prompt is also added for this case.

Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
 drivers/bluetooth/hci_qca.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index b621a0a40ea4..5c6bafe008ed 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2328,10 +2328,13 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
-		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");
+			if (IS_ERR(qcadev->bt_en))
+				dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
+			else
+				dev_err(&serdev->dev, "required BT_EN gpio is not configured\n");
 			power_ctrl_enabled = false;

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux