diff mbox series

Bluetooth: hci_sync: Fix suspend performance regression

Message ID 20220811212435.273142-1-luiz.dentz@gmail.com
State New
Headers show
Series Bluetooth: hci_sync: Fix suspend performance regression | expand

Commit Message

Luiz Augusto von Dentz Aug. 11, 2022, 9:24 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This attempts to fix suspend performance when there is no connections by
not updating the event mask.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_sync.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 11, 2022, 10 p.m. UTC | #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=667005

---Test result---

Test Summary:
CheckPatch                    PASS      0.88 seconds
GitLint                       PASS      0.47 seconds
SubjectPrefix                 PASS      0.29 seconds
BuildKernel                   PASS      32.86 seconds
BuildKernel32                 PASS      29.48 seconds
Incremental Build with patchesPASS      42.50 seconds
TestRunner: Setup             PASS      491.87 seconds
TestRunner: l2cap-tester      PASS      17.10 seconds
TestRunner: bnep-tester       PASS      6.38 seconds
TestRunner: mgmt-tester       PASS      104.11 seconds
TestRunner: rfcomm-tester     PASS      10.03 seconds
TestRunner: sco-tester        PASS      9.69 seconds
TestRunner: smp-tester        PASS      9.66 seconds
TestRunner: userchan-tester   PASS      6.73 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Aug. 17, 2022, 6:52 p.m. UTC | #2
Hello:

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

On Thu, 11 Aug 2022 14:24:35 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This attempts to fix suspend performance when there is no connections by
> not updating the event mask.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> [...]

Here is the summary with links:
  - Bluetooth: hci_sync: Fix suspend performance regression
    https://git.kernel.org/bluetooth/bluetooth-next/c/4e9f7d8bd56f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6de2ad730995..74a0cd5d0b37 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5549,17 +5549,21 @@  int hci_suspend_sync(struct hci_dev *hdev)
 	/* Prevent disconnects from causing scanning to be re-enabled */
 	hci_pause_scan_sync(hdev);
 
-	/* Soft disconnect everything (power off) */
-	err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF);
-	if (err) {
-		/* Set state to BT_RUNNING so resume doesn't notify */
-		hdev->suspend_state = BT_RUNNING;
-		hci_resume_sync(hdev);
-		return err;
-	}
+	if (hci_conn_count(hdev)) {
+		/* Soft disconnect everything (power off) */
+		err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF);
+		if (err) {
+			/* Set state to BT_RUNNING so resume doesn't notify */
+			hdev->suspend_state = BT_RUNNING;
+			hci_resume_sync(hdev);
+			return err;
+		}
 
-	/* Update event mask so only the allowed event can wakeup the host */
-	hci_set_event_mask_sync(hdev);
+		/* Update event mask so only the allowed event can wakeup the
+		 * host.
+		 */
+		hci_set_event_mask_sync(hdev);
+	}
 
 	/* Only configure accept list if disconnect succeeded and wake
 	 * isn't being prevented.