[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABBYNZ+Zq2HYsfGbOi7V=pnV1GczSv6--rMEbi+=yCXE4p+-6g@mail.gmail.com>
Date: Wed, 7 Jan 2026 09:47:57 -0500
From: Luiz Augusto von Dentz <luiz.dentz@...il.com>
To: Linmao Li <lilinmao@...inos.cn>
Cc: linux-bluetooth@...r.kernel.org, marcel@...tmann.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Bluetooth: btusb: Reject autosuspend if HCI inquiry or LE
scan is active
Hi Linmao,
On Tue, Jan 6, 2026 at 9:48 PM Linmao Li <lilinmao@...inos.cn> wrote:
>
> 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@...inos.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)))
We shall probably use hci_discovery_active instead of testing
individual bits like above.
> return -EBUSY;
>
> if (data->suspend_count++)
> --
> 2.25.1
>
--
Luiz Augusto von Dentz
Powered by blists - more mailing lists