From: Brian Norris <briannorris@chromium.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v1] ACPI: TAD: Improve runtime PM handling during driver removal
Date: Thu, 19 Nov 2026 13:56:52 -0800 [thread overview]
Message-ID: <av9wpJqw6D1m_izi@google.com> (raw)
In-Reply-To: <6052490.DvuYhMxLoT@rafael.j.wysocki>
On Thu, Nov 19, 2026 at 08:58:26PM +0100, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> In acpi_tad_remove(), instead of attempting a runtime suspend of the
> device which may be blocked by user space via "power/control", change
> the device's runtime PM status to "suspended" after disabling runtime
> PM for it to potentially unblock the runtime suspend of its parent and
> suppliers (if any).
>
> Since pm_runtime_suspend() is not called in acpi_tad_remove() any more,
> the latter need not drop the runtime PM reference to the device held by
> it, so make it use guard()() instead of scoped_guard() for acquiring
> that reference and reduce the indentation level.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/acpi_tad.c | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> --- a/drivers/acpi/acpi_tad.c
> +++ b/drivers/acpi/acpi_tad.c
> @@ -850,19 +850,21 @@ static void acpi_tad_remove(void *data)
>
> device_init_wakeup(dev, false);
>
> - scoped_guard(pm_runtime_noresume, dev) {
> - if (dd->capabilities & ACPI_TAD_AC_WAKE) {
> - acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
> - acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
> - }
> - if (dd->capabilities & ACPI_TAD_DC_WAKE) {
> - acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
> - acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
> - }
> + guard(pm_runtime_noresume)(dev);
> +
> + if (dd->capabilities & ACPI_TAD_AC_WAKE) {
> + acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
> + acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
> + }
> + if (dd->capabilities & ACPI_TAD_DC_WAKE) {
> + acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
> + acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
> }
>
> - pm_runtime_suspend(dev);
> pm_runtime_disable(dev);
> + /* Allow the parent and suppliers (if any) to suspend. */
> + pm_runtime_set_suspended(dev);
> + /* No need to power down, the PM domain detach will take care of it. */
Personally, I think it's a little odd to require coding patterns like
this (and comments, because it's admittedly subtle!) that assume
.runtime_suspend() is a no-op. But it works for simple drivers like
this, where the real work is done by others.
Anyway, that's just a general observation, and more of a framework
thing. This patch looks fine:
Reviewed-by: Brian Norris <briannorris@chromium.org>
BTW, should we drop pm_runtime_suspend() from probe() too? It's
susceptible to the same sort of problem, although it's a benign one
there. It's also a bit redundant, since there will be a post-probe()
idle request anyway.
Brian
> }
>
> static int acpi_tad_probe(struct platform_device *pdev)
>
>
>
prev parent reply other threads:[~2026-11-19 21:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 19:58 [PATCH v1] ACPI: TAD: Improve runtime PM handling during driver removal Rafael J. Wysocki
2026-11-19 21:56 ` Brian Norris [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=av9wpJqw6D1m_izi@google.com \
--to=briannorris@chromium.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--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