Netdev Archive on
help / color / mirror / Atom feed
From: Abhishek Pandit-Subedi <>
	Abhishek Pandit-Subedi <>,
	"David S. Miller" <>,
	Johan Hedberg <>,,,
	Jakub Kicinski <>,
	Miao-chen Chou <>
Subject: [PATCH v2] Bluetooth: Clear suspend tasks on unregister
Date: Mon, 31 Aug 2020 09:51:27 -0700	[thread overview]
Message-ID: <20200831095119.v2.1.I24fb6cc377d03d64d74f83cec748afd12ee33e37@changeid> (raw)

While unregistering, make sure to clear the suspend tasks before
cancelling the work. If the unregister is called during resume from
suspend, this will unnecessarily add 2s to the resume time otherwise.

Fixes: 4e8c36c3b0d73d (Bluetooth: Fix suspend notifier race)
Signed-off-by: Abhishek Pandit-Subedi <>
This was discovered with RT8822CE using the btusb driver. This chipset
will reset on resume during system suspend and was unnecessarily adding
2s to every resume. Since we're unregistering anyway, there's no harm in
just clearing the pending events.

Changes in v2:
- ++i to i++

 net/bluetooth/hci_core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 68bfe57b66250f..efc0fe2b47dac2 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3442,6 +3442,16 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
+static void hci_suspend_clear_tasks(struct hci_dev *hdev)
+	int i;
+	for (i = 0; i < __SUSPEND_NUM_TASKS; i++)
+		clear_bit(i, hdev->suspend_tasks);
+	wake_up(&hdev->suspend_wait_q);
 static int hci_suspend_wait_event(struct hci_dev *hdev)
 #define WAKE_COND                                                              \
@@ -3785,6 +3795,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
+	hci_suspend_clear_tasks(hdev);

             reply	other threads:[~2020-08-31 16:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 16:51 Abhishek Pandit-Subedi [this message]
2020-09-01 11:24 ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200831095119.v2.1.I24fb6cc377d03d64d74f83cec748afd12ee33e37@changeid \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2] Bluetooth: Clear suspend tasks on unregister' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).