* [PATCH v1] ACPI: TAD: Improve runtime PM handling during driver removal
@ 2026-11-19 19:58 Rafael J. Wysocki
2026-11-19 21:56 ` Brian Norris
0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-11-19 19:58 UTC (permalink / raw)
To: Linux ACPI; +Cc: Linux PM, Brian Norris
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. */
}
static int acpi_tad_probe(struct platform_device *pdev)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] ACPI: TAD: Improve runtime PM handling during driver removal
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
0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2026-11-19 21:56 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux ACPI, Linux PM
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)
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-19 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox