Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional()
Subsystems (2)
PATCH 1/1 Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional()
From: Bartosz Golaszewski <[email protected]>
Any return value from gpiod_get_optional() other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit 56d074d26c58 ("Bluetooth: hci_qca:
don't use IS_ERR_OR_NULL() with gpiod_get_optional()") no longer sets power_ctrl_enabled on NULL-pointer returned by devm_gpiod_get_optional(). Restore this behavior but bail-out on errors.
--- drivers/bluetooth/hci_qca.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +4 -1
@@ -2327,9 +2327,12 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855)) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" ); - power_ctrl_enabled = false; +return PTR_ERR (qcadev->bt_en); } +if (!qcadev->bt_en) + power_ctrl_enabled = false; + qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN ); if (IS_ERR(qcadev->sw_ctrl) &&
Signature · 1 line
2.40.1
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=846671
---Test result---
Test Summary:
CheckPatch FAIL 0.99 seconds GitLint FAIL 0.48 seconds SubjectPrefix PASS 2.50 seconds BuildKernel PASS 30.21 seconds CheckAllWarning PASS 32.96 seconds CheckSparse PASS 38.14 seconds CheckSmatch FAIL 36.37 seconds BuildKernel32 PASS 29.14 seconds TestRunnerSetup PASS 525.20 seconds TestRunner_l2cap-tester PASS 22.51 seconds TestRunner_iso-tester PASS 30.96 seconds TestRunner_bnep-tester PASS 4.65 seconds TestRunner_mgmt-tester FAIL 110.64 seconds TestRunner_rfcomm-tester PASS 7.23 seconds TestRunner_sco-tester PASS 14.91 seconds TestRunner_ioctl-tester PASS 7.72 seconds TestRunner_mesh-tester PASS 5.73 seconds TestRunner_smp-tester PASS 6.74 seconds TestRunner_userchan-tester PASS 4.84 seconds IncrementalBuild PASS 28.08 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional()
WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report #107:
total: 0 errors, 1 warnings, 13 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13638518.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional()
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
14: B1 Line exceeds max length (106>80): "Closes: https://lore.kernel.org/linux-bluetooth/[email protected]/"
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2
Failed Test Cases
LL Privacy - Add Device 7 (AL is full) Failed 0.198 seconds
---
Regards,
Linux Bluetooth
Quoted 9 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.
Quoted 5 lines
Reported-by Wren Turkal <[email protected]>Reported-by Zijun Hu <[email protected]>Fixes 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()")Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
Krzysztof
Quoted 23 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Reported-by Wren Turkal <[email protected]>Reported-by Zijun Hu <[email protected]>Fixes 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()")Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/bluetooth/hci_qca.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/bluetooth/hci_qca.c +0
-0
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2332
Quoted 7 lines
drivers/bluetooth/hci_qca.c +1
-1@@ -2327,9 +2327,12 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855)) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" ); - power_ctrl_enabled = false; +return PTR_ERR (qcadev->bt_en); }
For QCA6390, control logic do not reach here, so it has no any help for QCA6390.
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2335
Quoted 3 lines
drivers/bluetooth/hci_qca.c +3
-0+if (!qcadev->bt_en) + power_ctrl_enabled = false; +
property enable-gpios are obviously marked as required for WCN6750 and WCN6855 by dts binding spec as shown by below link:
https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
if user don't config the property then "qcadev->bt_en is NULL", can we still treat this case as good case?
that is why i changed my fix from reverting the wrong commit to only focusing on QCA6390.
i will give different fix for other impacted QCA controllers.
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2338
Quoted 3 lines
drivers/bluetooth/hci_qca.c +0
-0qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN ); if (IS_ERR(qcadev->sw_ctrl) &&
NAK as explained above.
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Quoted 28 lines
Reported-by Wren Turkal <[email protected]>Reported-by Zijun Hu <[email protected]>Fixes 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()")Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/bluetooth/hci_qca.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/bluetooth/hci_qca.c +4
-1@@ -2327,9 +2327,12 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855)) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" ); - power_ctrl_enabled = false; +return PTR_ERR (qcadev->bt_en); } +if (!qcadev->bt_en) + power_ctrl_enabled = false; + qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN ); if (IS_ERR(qcadev->sw_ctrl) &&
Signature · 1 line
You're more amazing than you think!
Quoted 10 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.
Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.
Could you give the following diff a try?
Bart
drivers/bluetooth/hci_qca.c +0 -0
@@ -2327,16 +2327,21 @@ static int qca_serdev_probe(struct
serdev_device *serdev)
(data->soc_type == QCA_WCN6750 ||
data->soc_type == QCA_WCN6855)) {
dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
- power_ctrl_enabled = false;
+ return PTR_ERR(qcadev->bt_en);
}
+ if (!qcadev->bt_en)
+ power_ctrl_enabled = false;
+
qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
GPIOD_IN);
if (IS_ERR(qcadev->sw_ctrl) &&
(data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855 ||
- data->soc_type == QCA_WCN7850))
- dev_warn(&serdev->dev, "failed to acquire SW_CTRL gpio\n");
+ data->soc_type == QCA_WCN7850)) {
+ dev_err(&serdev->dev, "failed to acquire SW_CTRL gpio\n");
+ return PTR_ERR(qcadev->sw_ctrl);
+ }
qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); if (IS_ERR(qcadev->susclk)) {
@@ -2355,10 +2360,13 @@ 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)) {
- dev_warn(&serdev->dev, "failed to acquire enable gpio\n");
- power_ctrl_enabled = false;
+ dev_err(&serdev->dev, "failed to acquire enable gpio\n");
+ return PTR_ERR(qcadev->bt_en);
}
+ if (!qcadev->bt_en)
+ power_ctrl_enabled = false;
+
qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); if (IS_ERR(qcadev->susclk)) {
dev_warn(&serdev->dev, "failed to acquire clk\n");
Quoted 71 lines · Bartosz Golaszewski
Quoted 10 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Bart
drivers/bluetooth/hci_qca.c +8
-3@@ -2327,16 +2327,21 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855)) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" ); - power_ctrl_enabled = false; +return PTR_ERR (qcadev->bt_en); } +if (!qcadev->bt_en) + power_ctrl_enabled = false; + qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN );if (IS_ERR (qcadev->sw_ctrl) && (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 || - data->soc_type ==QCA_WCN7850 )) -dev_warn (&serdev->dev,"failed to acquire SW_CTRL gpio\n" ); + data->soc_type ==QCA_WCN7850 )) { +dev_err (&serdev->dev,"failed to acquire SW_CTRL gpio\n" ); +return PTR_ERR (qcadev->sw_ctrl); + } qcadev->susclk =devm_clk_get_optional (&serdev->dev,NULL );drivers/bluetooth/hci_qca.c +5
-2if (IS_ERR (qcadev->susclk)) {@@ -2355,10 +2360,13 @@ 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)) { -dev_warn (&serdev->dev,"failed to acquire enable gpio\n" ); - power_ctrl_enabled = false; +dev_err (&serdev->dev,"failed to acquire enable gpio\n" ); +return PTR_ERR (qcadev->bt_en); } +if (!qcadev->bt_en) + power_ctrl_enabled = false; + qcadev->susclk =devm_clk_get_optional (&serdev->dev,NULL );if (IS_ERR (qcadev->susclk)) {
Quoted 1 line
dev_warn(&serdev->dev, "failed to acquire clk\n");
i suggest stop here and request you code review for my changes, i found the issue and given fix for my concern.
Quoted 67 lines · quic_zijuhu
Quoted 66 lines · Bartosz Golaszewski
Quoted 10 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Bart
drivers/bluetooth/hci_qca.c +8
-3@@ -2327,16 +2327,21 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type == QCA_WCN6750 || data->soc_type == QCA_WCN6855)) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" ); - power_ctrl_enabled = false; +return PTR_ERR (qcadev->bt_en); } +if (!qcadev->bt_en) + power_ctrl_enabled = false; + qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN );if (IS_ERR (qcadev->sw_ctrl) && (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 || - data->soc_type ==QCA_WCN7850 )) -dev_warn (&serdev->dev,"failed to acquire SW_CTRL gpio\n" ); + data->soc_type ==QCA_WCN7850 )) { +dev_err (&serdev->dev,"failed to acquire SW_CTRL gpio\n" ); +return PTR_ERR (qcadev->sw_ctrl); + } qcadev->susclk =devm_clk_get_optional (&serdev->dev,NULL );drivers/bluetooth/hci_qca.c +2
-2if (IS_ERR (qcadev->susclk)) {@@ -2355,10 +2360,13 @@ 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)) { -dev_warn (&serdev->dev,"failed to acquire enable gpio\n" ); - power_ctrl_enabled = false; +dev_err (&serdev->dev,"failed to acquire enable gpio\n" ); +return PTR_ERR (qcadev->bt_en); }
Quoted 8 lines
Quoted 6 lines
drivers/bluetooth/hci_qca.c +3
-0+if (!qcadev->bt_en) + power_ctrl_enabled = false; + qcadev->susclk =devm_clk_get_optional (&serdev->dev,NULL );if (IS_ERR (qcadev->susclk)) {
dev_warn(&serdev->dev, "failed to acquire clk\n");i suggest stop here and request you code review for my changes, i found the issue and given fix for my concern.
What are you answering to? What the heck are you implying here?
I think this crosses some threshold of ridiculous mailings.
Please get your managers or colleagues to review your patches and process you follow.
Best regards,
Krzysztof
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Quoted 7 lines
Quoted 3 lines
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Signature · 1 line
You're more amazing than you think!
Quoted 17 lines · Wren Turkal
Quoted 16 lines · Bartosz Golaszewski
Quoted 15 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Quoted 8 lines
Quoted 4 lines
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
@Zijun, this patch looks more idiomatic when I look at the surrounding code than your patch 1/2. Notice how it doesn't use the "else if" construct. It does the NULL test separately after checking for errors.
Signature · 1 line
You're more amazing than you think!
Quoted 27 lines · Wren Turkal
Quoted 25 lines · Wren Turkal
Quoted 23 lines · Bartosz Golaszewski
Quoted 11 lines · Wren Turkal
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Quoted 8 lines
Quoted 3 lines
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
Zijun didn't bail out on errors which is the issue the original patch tried to address and this one preserves.
Quoted 3 lines
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
Quoted 6 lines
@Zijun, this patch looks more idiomatic when I look at the surrounding code than your patch 1/2. Notice how it doesn't use the "else if" construct. It does the NULL test separately after checking for errors.
--
You're more amazing than you think!
Bart
Quoted 32 lines · Bartosz Golaszewski
Quoted 31 lines · Wren Turkal
Quoted 28 lines · Wren Turkal
Quoted 16 lines · Bartosz Golaszewski
Quoted 14 lines · Wren Turkal
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Quoted 7 lines
Quoted 3 lines
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Quoted 7 lines
Quoted 4 lines
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
Zijun didn't bail out on errors which is the issue the original patch tried to address and this one preserves.
Ah, I see that. Yeah, Zijun's 1/2 doesn't have the returns.
Quoted 15 lines
Quoted 3 lines
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
Quoted 6 lines
@Zijun, this patch looks more idiomatic when I look at the surrounding code than your patch 1/2. Notice how it doesn't use the "else if" construct. It does the NULL test separately after checking for errors.
--
You're more amazing than you think!Bart
Signature · 1 line
You're more amazing than you think!
Quoted 40 lines · Bartosz Golaszewski
Quoted 27 lines · Wren Turkal
Quoted 25 lines · Wren Turkal
Quoted 23 lines · Bartosz Golaszewski
Quoted 11 lines · Wren Turkal
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Quoted 8 lines
Quoted 3 lines
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
Zijun didn't bail out on errors which is the issue the original patch tried to address and this one preserves.
Quoted 6 lines
Quoted 3 lines
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Quoted 8 lines
Quoted 6 lines
@Zijun, this patch looks more idiomatic when I look at the surrounding code than your patch 1/2. Notice how it doesn't use the "else if" construct. It does the NULL test separately after checking for errors.
--
You're more amazing than you think!Bart
Signature · 1 line
You're more amazing than you think!
Quoted 42 lines · Wren Turkal
Quoted 40 lines · Bartosz Golaszewski
Quoted 27 lines · Wren Turkal
Quoted 25 lines · Wren Turkal
Quoted 23 lines · Bartosz Golaszewski
Quoted 11 lines · Wren Turkal
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Quoted 8 lines
Quoted 3 lines
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
Zijun didn't bail out on errors which is the issue the original patch tried to address and this one preserves.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Bart
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
@Zijun, this patch looks more idiomatic when I look at the surrounding code than your patch 1/2. Notice how it doesn't use the "else if" construct. It does the NULL test separately after checking for errors.
--
You're more amazing than you think!Bart
--
You're more amazing than you think!
Quoted 51 lines · Bartosz Golaszewski
Quoted 49 lines · Wren Turkal
Quoted 46 lines · Bartosz Golaszewski
Quoted 27 lines · Wren Turkal
Quoted 25 lines · Wren Turkal
Quoted 23 lines · Bartosz Golaszewski
Quoted 11 lines · Wren Turkal
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Quoted 8 lines
Quoted 3 lines
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
Zijun didn't bail out on errors which is the issue the original patch tried to address and this one preserves.
Quoted 3 lines
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
Quoted 8 lines
Quoted 2 lines
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Bart
Anyway, these are two separate issues. Let me send a v2 of this one to address at least one of them. I think Krzysztof will be better at fixing the other one as it's his patch that caused the second regression.
Bart
Quoted 47 lines · Bartosz Golaszewski
Quoted 46 lines · Wren Turkal
Quoted 44 lines · Bartosz Golaszewski
Quoted 27 lines · Wren Turkal
Quoted 25 lines · Wren Turkal
Quoted 23 lines · Bartosz Golaszewski
Quoted 11 lines · Wren Turkal
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Quoted 6 lines
Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
Quoted 8 lines
Quoted 3 lines
I had a feeling that was what was going on. I'll give the patch a shot.
wt
Considering this patch is basically equivalent to patch 1/2 from Zijun, I am not surprised that is works similarly. I.e. on a cold boot, I can disable/re-enable bluetooth as many time as I want.
Zijun didn't bail out on errors which is the issue the original patch tried to address and this one preserves.
Quoted 3 lines
However, since this patch doesn't include the quirk fix from Zijun's patchset (patch 2/2), bluetooth fails to work after a warm boot.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
To be specific, I have applied your patch and Zijun's 2/2 only.
Quoted 13 lines
Bart
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
@Zijun, this patch looks more idiomatic when I look at the surrounding code than your patch 1/2. Notice how it doesn't use the "else if" construct. It does the NULL test separately after checking for errors.
--
You're more amazing than you think!Bart
--
You're more amazing than you think!
Signature · 1 line
You're more amazing than you think!
Quoted 7 lines · Wren Turkal
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Quoted 7 lines
Quoted 2 lines
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Bart
Wren Turkal
Tested-byQuoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 7 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Got it. Thx.
BTW, should this patch's commit message include the following?
If so, please feel free to add it.
wt
Signature · 1 line
You're more amazing than you think!
Quoted 23 lines · Wren Turkal
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 7 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 6 lines
Got it. Thx.
BTW, should this patch's commit message include the following?
Tested-by "Wren Turkal" <[email protected]>
Please respond with this tag under the v2 patch and b4, patchwork or whatever other tools the maintainer will use will pick it up.
Thanks,
Bartosz
Quoted 5 lines
If so, please feel free to add it.
wt
--
You're more amazing than you think!
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 7 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Hey there. So, applying Zijun 2/2 on top of your patch does fix the warm boot problem for me. I can't speak about whether it's the right fix.
@Krzysztof Is the correct just add the conditional return for the quirk without reverting your earlier change?
wt
Signature · 1 line
You're more amazing than you think!
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
do you really realize what do you talk about?
do you really listen what do @Wren says?
he says that my patch 2/2 is right based on several verification results.
BTW, my 2/2 fix don't have anything about DTS usage.
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Quoted 1 line
Bart
Quoted 22 lines · quic_zijuhu
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 4 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +4 -0
@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags))return ; +if (test_bit (HCI_QUIRK_NON_PERSISTENT_SETUP , &hdev->quirks) || +hci_dev_test_flag (hdev,HCI_SETUP )) +return ; +serdev_device_write_flush (serdev); ret =serdev_device_write_buf (serdev, ibs_wake_cmd,sizeof (ibs_wake_cmd));
Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Signature · 1 line
You're more amazing than you think!
Quoted 47 lines · Wren Turkal
Quoted 23 lines · quic_zijuhu
Quoted 14 lines · Bartosz Golaszewski
Quoted 13 lines · Wren Turkal
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
That's OK, we have the first part right. Let's now see if we can reuse
patch 2/2 from Zijun.I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 4 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +1
-0@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags)) return; + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP,
Quoted 12 lines
&hdev->quirks) ||
+hci_dev_test_flag(hdev, HCI_SETUP))
+ return;
+
serdev_device_write_flush(serdev);
ret =serdev_device_write_buf(serdev, ibs_wake_cmd, sizeof(ibs_wake_cmd));Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Hi Wren,
i think i don't need to care about why wrong condition cause wrong results.
Quoted 56 lines · quic_zijuhu
Quoted 55 lines · Wren Turkal
Quoted 23 lines · quic_zijuhu
Quoted 14 lines · Bartosz Golaszewski
Quoted 13 lines · Wren Turkal
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
That's OK, we have the first part right. Let's now see if we can reuse
patch 2/2 from Zijun.I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 4 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +1
-0@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags)) return; + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP,
&hdev->quirks) ||
+hci_dev_test_flag(hdev, HCI_SETUP))
+ return;
+
serdev_device_write_flush(serdev);
ret =serdev_device_write_buf(serdev, ibs_wake_cmd, sizeof(ibs_wake_cmd));
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Hi Wren,
i think i don't need to care about why wrong condition cause wrong results.
I can't speak the intellectual purity of this patch. However, I can say that the patch works for my hardware. I am able to disable/enable on cold boot and on warm boot.
@Zijun, Functionally, it seems incorporate your new logic without reverting Krzysztof's. Are you saying this is incorrect logic?
wt
Signature · 1 line
You're more amazing than you think!
Quoted 55 lines · Wren Turkal
Quoted 22 lines · quic_zijuhu
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 4 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +1
-0@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags))return ; + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP,
&hdev->quirks) ||drivers/bluetooth/hci_qca.c +3
-0+ hci_dev_test_flag(hdev, HCI_SETUP)) +return ; +serdev_device_write_flush (serdev); ret =serdev_device_write_buf (serdev, ibs_wake_cmd,sizeof (ibs_wake_cmd));
Quoted 4 lines
Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Did you test it? Does it work? If so, please consider sending it upstream for review.
You can keep Zijun's authorship but add your own SoB tag at the end and mention what you did. Something like this:
Bartosz
Quoted 64 lines · Bartosz Golaszewski
Quoted 55 lines · Wren Turkal
Quoted 22 lines · quic_zijuhu
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
That's OK, we have the first part right. Let's now see if we can reuse patch 2/2 from Zijun.
I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 4 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +1
-0@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags))return ; + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP,
&hdev->quirks) ||drivers/bluetooth/hci_qca.c +3
-0+ hci_dev_test_flag(hdev, HCI_SETUP)) +return ; +serdev_device_write_flush (serdev); ret =serdev_device_write_buf (serdev, ibs_wake_cmd,sizeof (ibs_wake_cmd));Quoted 4 lines
Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Did you test it? Does it work? If so, please consider sending it upstream for review.
Quoted 7 lines
You can keep Zijun's authorship but add your own SoB tag at the end and mention what you did. Something like this:
[Wren: kept Krzysztof's fix]Signed-off-by Wren...Bartosz
@Bartosz, I have tested this, and it works functionally for my setup. I cannot detect a difference between this and Zijun's logic when I compile a kernel with this patch.
@Zijun, I think you have objections to this patch. I would like to make sure I hear your concern. Can you please take through it like I'm a 5 year old who barely knows C? In retrospect, I guess that I would be a pretty precocious 5 year old. LOL.
In all seriousness, @Zijun, I really appreciate the work you did on this. I would like to understand why you assert that removing the logic of Krzysztof is appropriate. Again, I am not a kernel developer, so this stuff is really outside my wheelhouse. Having said that, by my reading, which may very well be worng, it seems like you are just adding another case that is orthogonal to K's conditions. I'd like to truly understand you position to know if the patch I am suggesting is somehow harmful. This is an earnest question. I really want to respect your expertise here, and I really want you to know how much I appreciate your work.
wt
Signature · 1 line
You're more amazing than you think!
Quoted 66 lines · Wren Turkal
Quoted 65 lines · Bartosz Golaszewski
Quoted 63 lines · Wren Turkal
Quoted 24 lines · quic_zijuhu
Quoted 15 lines · Bartosz Golaszewski
Quoted 13 lines · Wren Turkal
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
That's OK, we have the first part right. Let's now see if we can reuse
patch 2/2 from Zijun.I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 5 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +1
-0@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags)) return; + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP,
&hdev->quirks) ||
+hci_dev_test_flag(hdev, HCI_SETUP))
+ return;
+
serdev_device_write_flush(serdev);
ret =serdev_device_write_buf(serdev, ibs_wake_cmd, sizeof(ibs_wake_cmd));Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Quoted 6 lines
Quoted 6 lines
Did you test it? Does it work? If so, please consider sending it upstream for review.
You can keep Zijun's authorship but add your own SoB tag at the end and mention what you did. Something like this:
[V7 2/2] as shown by below link is the formal fix.
https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/
this fix logic was introduced from the very beginning when i saw your issue description as shown by below link
https://lore.kernel.org/all/[email protected]/#t
Quoted 14 lines
Quoted 4 lines
[Wren: kept Krzysztof's fix]Signed-off-by Wren...Bartosz
@Bartosz, I have tested this, and it works functionally for my setup. I cannot detect a difference between this and Zijun's logic when I compile a kernel with this patch.
@Zijun, I think you have objections to this patch. I would like to make sure I hear your concern. Can you please take through it like I'm a 5 year old who barely knows C? In retrospect, I guess that I would be a pretty precocious 5 year old. LOL.
Quoted 10 lines
In all seriousness, @Zijun, I really appreciate the work you did on this. I would like to understand why you assert that removing the logic of Krzysztof is appropriate. Again, I am not a kernel developer, so this stuff is really outside my wheelhouse. Having said that, by my reading, which may very well be worng, it seems like you are just adding another case that is orthogonal to K's conditions. I'd like to truly understand you position to know if the patch I am suggesting is somehow harmful. This is an earnest question. I really want to respect your expertise here, and I really want you to know how much I appreciate your work. you maybe see all replies of [2/2] patch for this issue within below
link. i believe you will understand it. the bottom of the link includes all reply history.
https://lore.kernel.org/all/[email protected]/
Quoted 1 line
wt
Quoted 74 lines · quic_zijuhu
Quoted 66 lines · Wren Turkal
Quoted 65 lines · Bartosz Golaszewski
Quoted 63 lines · Wren Turkal
Quoted 24 lines · quic_zijuhu
Quoted 15 lines · Bartosz Golaszewski
Quoted 13 lines · Wren Turkal
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
That's OK, we have the first part right. Let's now see if we can reuse
patch 2/2 from Zijun.I'm compiling it right now. Be back soon.
Well I doubt it's correct as it removed Krzysztof's fix which looks right. If I were to guess I'd say we need some mix of both.
Patch 2/2 remove K's fix? I thought only 1/2 did that.
Quoted 8 lines
Quoted 2 lines
To be specific, I have applied your patch and Zijun's 2/2 only.
No, patch 1/2 from Zijun reverted my changes. Patch 2/2 removes Krzysztof's changes and replaces them with a different if else. This patch is a better alternative to Zijun's patch 1/2. For 2/2, I'll let Krzysztof handle it.
Quoted 5 lines
do you really realize what do you talk about?
do you really listen what do @Wren says?he says that my patch 2/2 is right based on several verification results.
she, not he
Quoted 1 line
BTW, my 2/2 fix don't have anything about DTS usage.
I think the problem with your 2/2 patch is that it removes the conditional bailing if the device is shutdown or not open.
Maybe this patch instead?
drivers/bluetooth/hci_qca.c +1
-0@@ -2456,6 +2456,10 @@ static void qca_serdev_shutdown(struct device *dev) !test_bit(HCI_RUNNING, &hdev->flags)) return; + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP,
&hdev->quirks) ||
+hci_dev_test_flag(hdev, HCI_SETUP))
+ return;
+
serdev_device_write_flush(serdev);
ret =serdev_device_write_buf(serdev, ibs_wake_cmd, sizeof(ibs_wake_cmd));Quoted 2 lines
he maybe be a DTS expert but not BT from his present fix history for bluetooth system.
Quoted 6 lines
Quoted 6 lines
Did you test it? Does it work? If so, please consider sending it upstream for review.
You can keep Zijun's authorship but add your own SoB tag at the end and mention what you did. Something like this:
Quoted 6 lines
[V7 2/2] as shown by below link is the formal fix.
https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/this fix logic was introduced from the very beginning when i saw your issue description as shown by below link
https://lore.kernel.org/all/[email protected]/#t
This is not quite fully correct. You did introduce that logic. However, you also removed the other conditional. That is what K.K. was objecting to. I literally copied your logic without deleting K.K.'s logic. My specific question is does that make my change incorrect in some way.
Quoted 24 lines
Quoted 14 lines
Quoted 4 lines
[Wren: kept Krzysztof's fix]Signed-off-by Wren...Bartosz
@Bartosz, I have tested this, and it works functionally for my setup. I cannot detect a difference between this and Zijun's logic when I compile a kernel with this patch.
@Zijun, I think you have objections to this patch. I would like to make sure I hear your concern. Can you please take through it like I'm a 5 year old who barely knows C? In retrospect, I guess that I would be a pretty precocious 5 year old. LOL.
Quoted 10 lines
In all seriousness, @Zijun, I really appreciate the work you did on this. I would like to understand why you assert that removing the logic of Krzysztof is appropriate. Again, I am not a kernel developer, so this stuff is really outside my wheelhouse. Having said that, by my reading, which may very well be worng, it seems like you are just adding another case that is orthogonal to K's conditions. I'd like to truly understand you position to know if the patch I am suggesting is somehow harmful. This is an earnest question. I really want to respect your expertise here, and I really want you to know how much I appreciate your work. you maybe see all replies of [2/2] patch for this issue within below
Quoted 3 lines
link. i believe you will understand it. the bottom of the link includes all reply history.
https://lore.kernel.org/all/[email protected]/
I read through the discussion again.
Can you please define VSC? I'm not sure what that means.
With regard to your change's logic.
First a kernel dev newbie question, does "hci_dev_test_flag(hdev, HCI_SETUP)" test whether the hardware has ever been setup? The rest of my discussions assumes that is the case.
So, basically, the logic in your change is something like this:
if dev_must_be_setup_every_time_opened || dev_is_in_setup_state
bail out on shutdown logic
If I am getting this correctly, you're saying that any device that must be setup is already by definition not needing setup and should not have shutdown logic run on it.
Okay, so question: Is it possible for a device to need setup (both not have the quirk and "hci_dev_test_flag(hdev, HCI_SETUP)" to have BT off or not be running?
Assuming the answer to that question is, "It is not possible." How do we know that? I think that may be what K.K. is saying is not obvious.
If the code ever gets into that state, shouldn't we at least log that the state is not an expected state?
I am now worried that allowing an unexpected state through could result in a unintended logic executing. How do I know I don't need to worry about that?
wt
Signature · 1 line
You're more amazing than you think!
Quoted 13 lines · Bartosz Golaszewski
Quoted 12 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Quoted 7 lines
Quoted 3 lines
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
I am compiling a kernel the patch right now, but I did want to let you know that the patch got corrupted by extra line wrapping. I'm not sure how you're sending it, but I thought you might want to know.
wt
Signature · 1 line
You're more amazing than you think!
Quoted 18 lines · Wren Turkal
Quoted 16 lines · Bartosz Golaszewski
Quoted 15 lines · Wren Turkal
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski<[email protected]>
Any return value from
gpiod_get_optional()other than a pointer to a GPIO descriptor or a NULL-pointer is an error and the driver should abort probing. That being said: commit56d074d26c58("Bluetooth:hci_qca:
don't useIS_ERR_OR_NULL()withgpiod_get_optional()") no longer setspower_ctrl_enabledon NULL-pointer returned bydevm_gpiod_get_optional(). Restore this behavior but bail-out on errors.Nack. This patch does fixes neither the disable/re-enable problem nor the warm boot problem.
Zijun replied to this patch also with what I think is the proper reasoning for why it doesn't fix my setup.
Quoted 9 lines
Quoted 4 lines
Indeed, I only addressed a single issue here and not the code under the
default: label of the switch case. Sorry.Could you give the following diff a try?
I am compiling a kernel the patch right now, but I did want to let you know that the patch got corrupted by extra line wrapping. I'm not sure how you're sending it, but I thought you might want to know.
This must be your email client wrapping lines over a certain limit. Try and get the diff from lore[1], it should be fine.
Bart
[1] https://lore.kernel.org/lkml/CAMRc=MepDwUbAKrWgm0CXKObqy8=igtug0QDgo-CgwxjZCAC2Q@mail.gmail.com/
Quoted 6 lines · Bartosz Golaszewski
This must be your email client wrapping lines over a certain limit. Try and get the diff from lore[1], it should be fine.
Bart
[1]https://lore.kernel.org/lkml/CAMRc=MepDwUbAKrWgm0CXKObqy8=igtug0QDgo-CgwxjZCAC2Q@mail.gmail.com/
I don't think it's my client. The extra newlines are right there in the lore link.
Look at the line that starts with "@@". That line is wrapped. The following line ("serdev_device *serdev)") should be at the end of the previous line. The same thing happened on the second "@@" line as well.
wt
Signature · 1 line
You're more amazing than you think!
Quoted 7 lines · Wren Turkal
Quoted 5 lines · Bartosz Golaszewski
This must be your email client wrapping lines over a certain limit. Try and get the diff from lore[1], it should be fine.
Bart
Quoted 9 lines
Quoted 1 line
[1]https://lore.kernel.org/lkml/CAMRc=MepDwUbAKrWgm0CXKObqy8=igtug0QDgo-CgwxjZCAC2Q@mail.gmail.com/
I don't think it's my client. The extra newlines are right there in the lore link.
Look at the line that starts with "@@". That line is wrapped. The following line ("
serdev_device*serdev)") should be at the end of the previous line. The same thing happened on the second "@@" line as well.
Indeed. I just noticed that it applies fine with git apply and figured the output must be right. Anyway, this is not a proper patch, I will send one once I adapt Zijun's code.
Bart
Quoted 18 lines · Bartosz Golaszewski
Quoted 7 lines · Wren Turkal
Quoted 5 lines · Bartosz Golaszewski
This must be your email client wrapping lines over a certain limit. Try and get the diff from lore[1], it should be fine.
Bart
Quoted 9 lines
Quoted 1 line
[1]https://lore.kernel.org/lkml/CAMRc=MepDwUbAKrWgm0CXKObqy8=igtug0QDgo-CgwxjZCAC2Q@mail.gmail.com/
I don't think it's my client. The extra newlines are right there in the lore link.
Look at the line that starts with "@@". That line is wrapped. The following line ("
serdev_device*serdev)") should be at the end of the previous line. The same thing happened on the second "@@" line as well.
Quoted 5 lines
Indeed. I just noticed that it applies fine with git apply and figured the output must be right. Anyway, this is not a proper patch, I will send one once I adapt Zijun's code.
Bart
Weird. Git apply failed for me. That's how I noticed it.
From my terminal:
➜ linux git:(my_master) ✗ git apply ../blah.diff
error: corrupt patch at line 6
FWIW, I also tried pasting it into stdin by running git apply as well.
wt
Signature · 1 line
You're more amazing than you think!