Skip to content

Commit 123f6d3

Browse files
committed
Bluetooth: hci_sync: Fix suspend performance regression
This attempts to fix suspend performance when there is no connections by not updating the event mask. Fixes: ef61b6e ("Bluetooth: Always set event mask on suspend") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent afcb336 commit 123f6d3

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

net/bluetooth/hci_sync.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5549,17 +5549,21 @@ int hci_suspend_sync(struct hci_dev *hdev)
55495549
/* Prevent disconnects from causing scanning to be re-enabled */
55505550
hci_pause_scan_sync(hdev);
55515551

5552-
/* Soft disconnect everything (power off) */
5553-
err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF);
5554-
if (err) {
5555-
/* Set state to BT_RUNNING so resume doesn't notify */
5556-
hdev->suspend_state = BT_RUNNING;
5557-
hci_resume_sync(hdev);
5558-
return err;
5559-
}
5552+
if (hci_conn_count(hdev)) {
5553+
/* Soft disconnect everything (power off) */
5554+
err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF);
5555+
if (err) {
5556+
/* Set state to BT_RUNNING so resume doesn't notify */
5557+
hdev->suspend_state = BT_RUNNING;
5558+
hci_resume_sync(hdev);
5559+
return err;
5560+
}
55605561

5561-
/* Update event mask so only the allowed event can wakeup the host */
5562-
hci_set_event_mask_sync(hdev);
5562+
/* Update event mask so only the allowed event can wakeup the
5563+
* host.
5564+
*/
5565+
hci_set_event_mask_sync(hdev);
5566+
}
55635567

55645568
/* Only configure accept list if disconnect succeeded and wake
55655569
* isn't being prevented.

0 commit comments

Comments
 (0)