From: Daniel Golle <daniel@makrotopia.org>
To: Nikolay Bryskin <nbryskin@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Miri Korenblit <miriam.rachel.korenblit@intel.com>,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
Hans de Goede <hansg@kernel.org>,
linux-bluetooth@vger.kernel.org,
Bartosz Golaszewski <brgl@kernel.org>,
Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Rocky Liao <quic_rjliao@quicinc.com>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_qca: Reprobe QCA6390 after hibernation
Date: Mon, 19 Oct 2026 10:30:06 +0100 [thread overview]
Message-ID: <atXiYxot6UZ3MDrp@makrotopia.org> (raw)
In-Reply-To: <20261017174310.22484-1-nbryskin@gmail.com>
Hi Nikolay,
On Sat, Oct 17, 2026 at 08:43:10PM +0300, Nikolay Bryskin wrote:
> +static void qca_reprobe_work(struct work_struct *work)
> +{
> + struct qca_reprobe *reprobe = container_of(work, struct qca_reprobe,
> + work);
> + int ret;
> +
> + ret = device_reprobe(reprobe->dev);
> + if (ret && ret != -EPROBE_DEFER)
> + dev_err(reprobe->dev, "Failed to reprobe device (error %d)\n",
> + ret);
> +
> + put_device(reprobe->dev);
> + kfree(reprobe);
> +}
This is the pattern hci_h5 and iwlwifi use today, and it has the same
two problems, which the series at [1] addresses with a driver core
helper, device_schedule_reprobe():
- qca_reprobe_work() lives in hci_uart.ko and nothing pins the module.
The work runs from thaw for the whole re-probe, firmware download
included, and an rmmod of hci_uart in that time frees the text it is
executing as well as the lock class key INIT_WORK() placed in module
data. On a lockdep kernel the latter ends in an oops; we reproduced
that with the equivalent iwlwifi work.
- device_reprobe() runs whatever is bound by then, so an unbind between
thaw and the work starting is undone.
With the helper the work item goes away entirely, and qca_restore()
becomes:
static int __maybe_unused qca_restore(struct device *dev)
{
struct serdev_device *serdev = to_serdev_device(dev);
struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
struct hci_uart *hu = &qcadev->serdev_hu;
qca_resume(dev);
if (hci_test_quirk(hu->hdev, HCI_QUIRK_NON_PERSISTENT_SETUP))
return 0;
return device_schedule_reprobe(dev, 0);
}
It may be called from .restore with the device lock held, runs on
system_freezable_wq as yours does, and its request is cancelled if the
device is unbound, removed or its module unloaded before it runs.
Would you be fine basing your patch on it once it has landed?
[1] https://lore.kernel.org/all/cover.1792203271.git.daniel@makrotopia.org/
Cheers,
Daniel
prev parent reply other threads:[~2026-10-19 9:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 17:43 [PATCH] Bluetooth: hci_qca: Reprobe QCA6390 after hibernation Nikolay Bryskin
2026-10-17 19:30 ` bluez.test.bot
2026-10-19 9:30 ` Daniel Golle [this message]
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=atXiYxot6UZ3MDrp@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=emmanuel.grumbach@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=miriam.rachel.korenblit@intel.com \
--cc=nbryskin@gmail.com \
--cc=quic_rjliao@quicinc.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox