|
Lee, Chun-Yi |
861106 |
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
|
Lee, Chun-Yi |
861106 |
Date: Thu, 11 Aug 2022 14:20:46 -0700
|
|
Lee, Chun-Yi |
861106 |
Subject: Bluetooth: hci_sync: Fix suspend performance regression
|
|
Lee, Chun-Yi |
861106 |
Patch-mainline: v6.0-rc4
|
|
Lee, Chun-Yi |
861106 |
Git-commit: 1fd02d56dae35b08e4cba8e6bd2c2e7ccff68ecc
|
|
Lee, Chun-Yi |
861106 |
References: jsc#PED-1407
|
|
Lee, Chun-Yi |
861106 |
|
|
Lee, Chun-Yi |
861106 |
This attempts to fix suspend performance when there is no connections by
|
|
Lee, Chun-Yi |
861106 |
not updating the event mask.
|
|
Lee, Chun-Yi |
861106 |
|
|
Lee, Chun-Yi |
861106 |
Fixes: ef61b6ea1544 ("Bluetooth: Always set event mask on suspend")
|
|
Lee, Chun-Yi |
861106 |
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
|
Lee, Chun-Yi |
861106 |
Acked-by: Lee, Chun-Yi <jlee@suse.com>
|
|
Lee, Chun-Yi |
861106 |
---
|
|
Lee, Chun-Yi |
861106 |
net/bluetooth/hci_sync.c | 24 ++++++++++++++----------
|
|
Lee, Chun-Yi |
861106 |
1 file changed, 14 insertions(+), 10 deletions(-)
|
|
Lee, Chun-Yi |
861106 |
|
|
Lee, Chun-Yi |
861106 |
--- a/net/bluetooth/hci_sync.c
|
|
Lee, Chun-Yi |
861106 |
+++ b/net/bluetooth/hci_sync.c
|
|
Lee, Chun-Yi |
861106 |
@@ -4964,17 +4964,21 @@ int hci_suspend_sync(struct hci_dev *hde
|
|
Lee, Chun-Yi |
861106 |
/* Prevent disconnects from causing scanning to be re-enabled */
|
|
Lee, Chun-Yi |
861106 |
hci_pause_scan_sync(hdev);
|
|
Lee, Chun-Yi |
861106 |
|
|
Lee, Chun-Yi |
861106 |
- /* Soft disconnect everything (power off) */
|
|
Lee, Chun-Yi |
861106 |
- err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF);
|
|
Lee, Chun-Yi |
861106 |
- if (err) {
|
|
Lee, Chun-Yi |
861106 |
- /* Set state to BT_RUNNING so resume doesn't notify */
|
|
Lee, Chun-Yi |
861106 |
- hdev->suspend_state = BT_RUNNING;
|
|
Lee, Chun-Yi |
861106 |
- hci_resume_sync(hdev);
|
|
Lee, Chun-Yi |
861106 |
- return err;
|
|
Lee, Chun-Yi |
861106 |
- }
|
|
Lee, Chun-Yi |
861106 |
+ if (hci_conn_count(hdev)) {
|
|
Lee, Chun-Yi |
861106 |
+ /* Soft disconnect everything (power off) */
|
|
Lee, Chun-Yi |
861106 |
+ err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF);
|
|
Lee, Chun-Yi |
861106 |
+ if (err) {
|
|
Lee, Chun-Yi |
861106 |
+ /* Set state to BT_RUNNING so resume doesn't notify */
|
|
Lee, Chun-Yi |
861106 |
+ hdev->suspend_state = BT_RUNNING;
|
|
Lee, Chun-Yi |
861106 |
+ hci_resume_sync(hdev);
|
|
Lee, Chun-Yi |
861106 |
+ return err;
|
|
Lee, Chun-Yi |
861106 |
+ }
|
|
Lee, Chun-Yi |
861106 |
|
|
Lee, Chun-Yi |
861106 |
- /* Update event mask so only the allowed event can wakeup the host */
|
|
Lee, Chun-Yi |
861106 |
- hci_set_event_mask_sync(hdev);
|
|
Lee, Chun-Yi |
861106 |
+ /* Update event mask so only the allowed event can wakeup the
|
|
Lee, Chun-Yi |
861106 |
+ * host.
|
|
Lee, Chun-Yi |
861106 |
+ */
|
|
Lee, Chun-Yi |
861106 |
+ hci_set_event_mask_sync(hdev);
|
|
Lee, Chun-Yi |
861106 |
+ }
|
|
Lee, Chun-Yi |
861106 |
|
|
Lee, Chun-Yi |
861106 |
/* Only configure accept list if disconnect succeeded and wake
|
|
Lee, Chun-Yi |
861106 |
* isn't being prevented.
|