public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place
@ 2025-05-27  7:47 Bartosz Golaszewski
  2025-05-27  8:02 ` Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2025-05-27  7:47 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Krzysztof Kozlowski
  Cc: Hsin-chen Chuang, Balakrishna Godavarthi, Jiating Wang,
	Vincent Chuang, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski, stable

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Commit 3d05fc82237a ("Bluetooth: qca: set power_ctrl_enabled on NULL
returned by gpiod_get_optional()") accidentally changed the prevous
behavior where power control would be disabled without the BT_EN GPIO
only on QCA_WCN6750 and QCA_WCN6855 while also getting the error check
wrong. We should treat every IS_ERR() return value from
devm_gpiod_get_optional() as a reason to bail-out while we should only
set power_ctrl_enabled to false on the two models mentioned above. While
at it: use dev_err_probe() to save a LOC.

Cc: stable@vger.kernel.org
Fixes: 3d05fc82237a ("Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional()")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/bluetooth/hci_qca.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index e00590ba24fdb..a2dc39c005f4f 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2415,14 +2415,14 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 
 		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
 					       GPIOD_OUT_LOW);
-		if (IS_ERR(qcadev->bt_en) &&
-		    (data->soc_type == QCA_WCN6750 ||
-		     data->soc_type == QCA_WCN6855)) {
-			dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
-			return PTR_ERR(qcadev->bt_en);
-		}
+		if (IS_ERR(qcadev->bt_en))
+			return dev_err_probe(&serdev->dev,
+					     PTR_ERR(qcadev->bt_en),
+					     "failed to acquire BT_EN gpio\n");
 
-		if (!qcadev->bt_en)
+		if (!qcadev->bt_en &&
+		    (data->soc_type == QCA_WCN6750 ||
+		     data->soc_type == QCA_WCN6855))
 			power_ctrl_enabled = false;
 
 		qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place
  2025-05-27  7:47 [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place Bartosz Golaszewski
@ 2025-05-27  8:02 ` Krzysztof Kozlowski
  2025-05-27  8:39 ` bluez.test.bot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-27  8:02 UTC (permalink / raw)
  To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Hsin-chen Chuang, Balakrishna Godavarthi, Jiating Wang,
	Vincent Chuang, linux-bluetooth, linux-kernel,
	Bartosz Golaszewski, stable

On 27/05/2025 09:47, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Commit 3d05fc82237a ("Bluetooth: qca: set power_ctrl_enabled on NULL
> returned by gpiod_get_optional()") accidentally changed the prevous
> behavior where power control would be disabled without the BT_EN GPIO
> only on QCA_WCN6750 and QCA_WCN6855 while also getting the error check
> wrong. We should treat every IS_ERR() return value from
> devm_gpiod_get_optional() as a reason to bail-out while we should only
> set power_ctrl_enabled to false on the two models mentioned above. While
> at it: use dev_err_probe() to save a LOC.

... and to fix spamming kernel logs on deferred probe.


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Bluetooth: hci_qca: move the SoC type check to the right place
  2025-05-27  7:47 [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place Bartosz Golaszewski
  2025-05-27  8:02 ` Krzysztof Kozlowski
@ 2025-05-27  8:39 ` bluez.test.bot
  2025-05-27  9:04 ` [PATCH] " Hsin-chen Chuang
  2025-05-27 13:20 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-05-27  8:39 UTC (permalink / raw)
  To: linux-bluetooth, brgl

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=966577

---Test result---

Test Summary:
CheckPatch                    PENDING   0.36 seconds
GitLint                       PENDING   0.24 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      24.24 seconds
CheckAllWarning               PASS      27.40 seconds
CheckSparse                   PASS      30.50 seconds
BuildKernel32                 PASS      24.08 seconds
TestRunnerSetup               PASS      455.94 seconds
TestRunner_l2cap-tester       PASS      25.19 seconds
TestRunner_iso-tester         PASS      41.68 seconds
TestRunner_bnep-tester        PASS      5.98 seconds
TestRunner_mgmt-tester        FAIL      131.47 seconds
TestRunner_rfcomm-tester      PASS      9.30 seconds
TestRunner_sco-tester         PASS      14.75 seconds
TestRunner_ioctl-tester       PASS      9.99 seconds
TestRunner_mesh-tester        PASS      7.39 seconds
TestRunner_smp-tester         PASS      8.55 seconds
TestRunner_userchan-tester    PASS      6.25 seconds
IncrementalBuild              PENDING   0.65 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.192 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place
  2025-05-27  7:47 [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place Bartosz Golaszewski
  2025-05-27  8:02 ` Krzysztof Kozlowski
  2025-05-27  8:39 ` bluez.test.bot
@ 2025-05-27  9:04 ` Hsin-chen Chuang
  2025-05-27 13:20 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: Hsin-chen Chuang @ 2025-05-27  9:04 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Krzysztof Kozlowski,
	Balakrishna Godavarthi, Jiating Wang, Vincent Chuang,
	linux-bluetooth, linux-kernel, Bartosz Golaszewski, stable

On Tue, May 27, 2025 at 3:47 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Commit 3d05fc82237a ("Bluetooth: qca: set power_ctrl_enabled on NULL
> returned by gpiod_get_optional()") accidentally changed the prevous

typo: previous

> behavior where power control would be disabled without the BT_EN GPIO
> only on QCA_WCN6750 and QCA_WCN6855 while also getting the error check
> wrong. We should treat every IS_ERR() return value from
> devm_gpiod_get_optional() as a reason to bail-out while we should only
> set power_ctrl_enabled to false on the two models mentioned above. While
> at it: use dev_err_probe() to save a LOC.
>
> Cc: stable@vger.kernel.org
> Fixes: 3d05fc82237a ("Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional()")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/bluetooth/hci_qca.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index e00590ba24fdb..a2dc39c005f4f 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -2415,14 +2415,14 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>
>                 qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
>                                                GPIOD_OUT_LOW);
> -               if (IS_ERR(qcadev->bt_en) &&
> -                   (data->soc_type == QCA_WCN6750 ||
> -                    data->soc_type == QCA_WCN6855)) {
> -                       dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
> -                       return PTR_ERR(qcadev->bt_en);
> -               }
> +               if (IS_ERR(qcadev->bt_en))
> +                       return dev_err_probe(&serdev->dev,
> +                                            PTR_ERR(qcadev->bt_en),
> +                                            "failed to acquire BT_EN gpio\n");
>
> -               if (!qcadev->bt_en)
> +               if (!qcadev->bt_en &&
> +                   (data->soc_type == QCA_WCN6750 ||
> +                    data->soc_type == QCA_WCN6855))
>                         power_ctrl_enabled = false;
>
>                 qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
> --
> 2.48.1
>

Thanks for the fix!

Tested on a Chromebook device with WCN3991 chip.
Without the patch the hdev->reset callback would make the HCI device
unrecoverable, and with the patch the callback can reset the HCI
device smoothly.

Tested-by: Hsin-chen Chuang <chharry@chromium.org>
Reviewed-by: Hsin-chen Chuang <chharry@chromium.org>


Best Regards,
Hsin-chen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place
  2025-05-27  7:47 [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2025-05-27  9:04 ` [PATCH] " Hsin-chen Chuang
@ 2025-05-27 13:20 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2025-05-27 13:20 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: marcel, luiz.dentz, krzysztof.kozlowski, chharry, bgodavar,
	jiatingw, vincentch, linux-bluetooth, linux-kernel,
	bartosz.golaszewski, stable

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 27 May 2025 09:47:37 +0200 you wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Commit 3d05fc82237a ("Bluetooth: qca: set power_ctrl_enabled on NULL
> returned by gpiod_get_optional()") accidentally changed the prevous
> behavior where power control would be disabled without the BT_EN GPIO
> only on QCA_WCN6750 and QCA_WCN6855 while also getting the error check
> wrong. We should treat every IS_ERR() return value from
> devm_gpiod_get_optional() as a reason to bail-out while we should only
> set power_ctrl_enabled to false on the two models mentioned above. While
> at it: use dev_err_probe() to save a LOC.
> 
> [...]

Here is the summary with links:
  - Bluetooth: hci_qca: move the SoC type check to the right place
    https://git.kernel.org/bluetooth/bluetooth-next/c/8df2c74d466c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-27 13:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27  7:47 [PATCH] Bluetooth: hci_qca: move the SoC type check to the right place Bartosz Golaszewski
2025-05-27  8:02 ` Krzysztof Kozlowski
2025-05-27  8:39 ` bluez.test.bot
2025-05-27  9:04 ` [PATCH] " Hsin-chen Chuang
2025-05-27 13:20 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox