summaryrefslogtreecommitdiff
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAbhishek Pandit-Subedi <abhishekpandit@chromium.org>2021-03-01 23:06:04 +0300
committerMarcel Holtmann <marcel@holtmann.org>2021-03-02 17:02:55 +0300
commit5cb08553f7f2536f2f5a9142a060af2a77c1d5dc (patch)
tree089b3966b2b83d495dc2e1165af192f1fda2eb71 /net/bluetooth
parent201cf3976c065fc47ab260302d06690f73587df9 (diff)
downloadlinux-5cb08553f7f2536f2f5a9142a060af2a77c1d5dc.tar.xz
Bluetooth: Notify suspend on le conn failed
When suspending, Bluetooth disconnects all connected peers devices. If an LE connection is started but isn't completed, we will see an LE Create Connection Cancel instead of an HCI disconnect. This just adds a check to see if an LE cancel was the last disconnected device and wake the suspend thread when that is the case. Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Reviewed-by: Archie Pusaka <apusaka@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_conn.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 6ffa89e3ba0a..468d31f3303d 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -772,6 +772,16 @@ void hci_le_conn_failed(struct hci_conn *conn, u8 status)
hci_conn_del(conn);
+ /* The suspend notifier is waiting for all devices to disconnect and an
+ * LE connect cancel will result in an hci_le_conn_failed. Once the last
+ * connection is deleted, we should also wake the suspend queue to
+ * complete suspend operations.
+ */
+ if (list_empty(&hdev->conn_hash.list) &&
+ test_and_clear_bit(SUSPEND_DISCONNECTING, hdev->suspend_tasks)) {
+ wake_up(&hdev->suspend_wait_q);
+ }
+
/* Since we may have temporarily stopped the background scanning in
* favor of connection establishment, we should restart it.
*/