Skip to content

Commit

Permalink
Bluetooth: hci_sync: Fix suspend performance regression
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luiz Augusto von Dentz committed Aug 25, 2022
1 parent afcb336 commit 123f6d3
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions net/bluetooth/hci_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 123f6d3

Please sign in to comment.