[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABBYNZJR9SB4EAMi5C0bf-ezMSa0rt02W8zVM0ypBwrqqxcPuQ@mail.gmail.com>
Date: Thu, 8 Jan 2026 10:22:12 -0500
From: Luiz Augusto von Dentz <luiz.dentz@...il.com>
To: Linmao Li <lilinmao@...inos.cn>
Cc: marcel@...tmann.org, linux-kernel@...r.kernel.org,
linux-bluetooth@...r.kernel.org
Subject: Re: [PATCH v2] Bluetooth: btusb: Reject autosuspend if discovery is active
Hi Linmao,
On Wed, Jan 7, 2026 at 9:53 PM Linmao Li <lilinmao@...inos.cn> wrote:
>
> 在 2026/1/8 10:06, Linmao Li 写道:
>
> > If USB autosuspend occurs while discovery 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 | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> > index ded09e94d296..565e276be3b2 100644
> > --- a/drivers/bluetooth/btusb.c
> > +++ b/drivers/bluetooth/btusb.c
> > @@ -4469,10 +4469,11 @@ 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 discovery 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) || hci_discovery_active(data->hdev)))
> > return -EBUSY;
> >
> > if (data->suspend_count++)
> Hi Luiz,
>
> I found that hci_discovery_active() is not exported, so btusb as a
> module cannot use it:
>
> ERROR: modpost: "hci_discovery_active" [drivers/bluetooth/btusb.ko]
> undefined!
>
> Should I send a separate patch to export hci_discovery_active(), or
> revert to v1 using test_bit(HCI_INQUIRY) and hci_dev_test_flag(HCI_LE_SCAN)?
Just add a patch exporting it.
--
Luiz Augusto von Dentz
Powered by blists - more mailing lists