Skip to contentSkip to conversation

Bluetooth: btusb: Don't fail external suspend requests

PATCH Superseded Luiz Augusto von Dentz 2 participants 2 messages Jul 8, 2024 Bluetooth drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: btusb: Don't fail external suspend requests

From: Luiz Augusto von Dentz <[email protected]>

Commit 4e0a1d8b0675
("Bluetooth: btusb: Don't suspend when there are connections") introduces a check for connections to prevent auto-suspend but that actually ignored the fact the .suspend callback can be called for external suspend requests which Documentation/driver-api/usb/power-management.rst states the following:

'External suspend calls should never be allowed to fail in this way, only autosuspend calls. The driver can tell them apart by applying the :c:func:PMSG_IS_AUTO macro to the message argument to the ``suspend`` method; it will return True for internal PM events (autosuspend) and False for external PM events.'

Fixes 4e0a1d8b0675 ("Bluetooth: btusb: Don't suspend when there are connections")
---
 drivers/bluetooth/btusb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/bluetooth/btusb.c +4 -2
index 2d5c971a59ad..bbd75ba9874a 100644
@@ -4700,8 +4700,10 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
 
 	BT_DBG("intf %p", intf);
 
-	/* Don't suspend if there are connections */
-	if (hci_conn_count(data->hdev))
+	/* Don't auto-suspend if there are connections as external suspend calls
+	 * should never be allowed to fail.
+	 */
+	if (PMSG_IS_AUTO(message) && hci_conn_count(data->hdev))
 		return -EBUSY;
 
 	if (data->suspend_count++)
Signature · 1 line
2.45.2
#1 lore raw

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=869381

---Test result---

Test Summary:

CheckPatch                    PENDING   63.99 seconds
GitLint                       PENDING   33.69 seconds
SubjectPrefix                 PENDING   31.67 seconds
BuildKernel                   PASS      30.07 seconds
CheckAllWarning               PASS      32.94 seconds
CheckSparse                   PASS      38.81 seconds
CheckSmatch                   PENDING   141.37 seconds
BuildKernel32                 PASS      57.05 seconds
TestRunnerSetup               PENDING   574.70 seconds
TestRunner_l2cap-tester       PENDING   53.99 seconds
TestRunner_iso-tester         PENDING   70.02 seconds
TestRunner_bnep-tester        PENDING   13.29 seconds
TestRunner_mgmt-tester        FAIL      115.09 seconds
TestRunner_rfcomm-tester      PASS      10.63 seconds
TestRunner_sco-tester         PASS      16.49 seconds
TestRunner_ioctl-tester       PASS      8.25 seconds
TestRunner_mesh-tester        PASS      6.04 seconds
TestRunner_smp-tester         PASS      7.05 seconds
TestRunner_userchan-tester    PASS      5.14 seconds
IncrementalBuild              PASS      28.49 seconds

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

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

##############################
Test: SubjectPrefix - PENDING
Desc: Check subject contains "Bluetooth" prefix Output:

##############################
Test: CheckSmatch - PENDING
Desc: Run smatch tool with source Output:

##############################
Test: TestRunnerSetup - PENDING
Desc: Setup kernel and bluez for test-runner Output:

##############################
Test: TestRunner_l2cap-tester - PENDING
Desc: Run l2cap-tester with test-runner Output:

##############################
Test: TestRunner_iso-tester - PENDING
Desc: Run iso-tester with test-runner Output:

##############################
Test: TestRunner_bnep-tester - PENDING
Desc: Run bnep-tester with test-runner Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 492, Passed: 487 (99.0%), Failed: 3, Not Run: 2

Failed Test Cases

LL Privacy - Add Device 4 (2 Devices to AL)          Failed       0.162 seconds
LL Privacy - Add Device 6 (RL is full)               Failed       0.198 seconds
LL Privacy - Add Device 7 (AL is full)               Failed       0.199 seconds

---
Regards,
Linux Bluetooth