public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: Reject autosuspend if HCI inquiry or LE scan is active
@ 2026-01-07  2:48 Linmao Li
  2026-01-07  3:35 ` bluez.test.bot
  2026-01-07 14:47 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 12+ messages in thread
From: Linmao Li @ 2026-01-07  2:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, luiz.dentz, linux-kernel, Linmao Li

If USB autosuspend occurs while BR/EDR inquiry or LE scan is active,
the ongoing HCI operation may not complete successfully. On some
devices, this can leave discovery.state stuck in DISCOVERY_FINDING.

Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
 drivers/bluetooth/btusb.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ded09e94d296..885c3d8c0a10 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4469,10 +4469,13 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
 
 	BT_DBG("intf %p", intf);
 
-	/* Don't auto-suspend if there are connections; external suspend calls
-	 * shall never fail.
+	/* Don't auto-suspend if there are connections or HCI operations in
+	 * progress; external suspend calls shall never fail.
 	 */
-	if (PMSG_IS_AUTO(message) && hci_conn_count(data->hdev))
+	if (PMSG_IS_AUTO(message) &&
+	    (hci_conn_count(data->hdev) ||
+	    test_bit(HCI_INQUIRY, &data->hdev->flags) ||
+	    hci_dev_test_flag(data->hdev, HCI_LE_SCAN)))
 		return -EBUSY;
 
 	if (data->suspend_count++)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-01-12 21:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07  2:48 [PATCH] Bluetooth: btusb: Reject autosuspend if HCI inquiry or LE scan is active Linmao Li
2026-01-07  3:35 ` bluez.test.bot
2026-01-07 14:47 ` [PATCH] " Luiz Augusto von Dentz
2026-01-08  2:06   ` [PATCH v2] Bluetooth: btusb: Reject autosuspend if discovery " Linmao Li
2026-01-08  2:52     ` Linmao Li
2026-01-08 15:22       ` Luiz Augusto von Dentz
2026-01-09  2:05         ` [PATCH v3 0/2] " Linmao Li
2026-01-09  2:05           ` [PATCH v3 1/2] Bluetooth: hci_core: Export hci_discovery_active Linmao Li
2026-01-09  3:37             ` Bluetooth: btusb: Reject autosuspend if discovery is active bluez.test.bot
2026-01-09  2:05           ` [PATCH v3 2/2] " Linmao Li
2026-01-12 20:58           ` [PATCH v3 0/2] " patchwork-bot+bluetooth
2026-01-08  3:34     ` [v2] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox