]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: TAD: Rearrange runtime PM operations in acpi_tad_remove()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 21 Oct 2025 17:33:39 +0000 (19:33 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 27 Oct 2025 19:32:13 +0000 (20:32 +0100)
It is not necessary to resume the device upfront in acpi_tad_remove()
because both acpi_tad_disable_timer() and acpi_tad_clear_status()
attempt to resume it, but it is better to prevent it from suspending
between these calls by incrementing its runtime PM usage counter.

Accordingly, replace the pm_runtime_get_sync() call in acpi_tad_remove()
with a pm_runtime_get_noresume() one and put the latter right before the
first invocation of acpi_tad_disable_timer().

In addition, use pm_runtime_put_noidle() to drop the device's runtime
PM usage counter after using pm_runtime_get_noresume() to bump it up
to follow a common pattern and use pm_runtime_suspend() for suspending
the device afterward.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/5031965.GXAFRqVoOG@rafael.j.wysocki
drivers/acpi/acpi_tad.c

index 33418dd6768a1b112486ee2c875fee71583b6029..651a2b9958447ddd5a827e2c8e09c40dea2cdd1e 100644 (file)
@@ -563,8 +563,6 @@ static void acpi_tad_remove(struct platform_device *pdev)
 
        device_init_wakeup(dev, false);
 
-       pm_runtime_get_sync(dev);
-
        if (dd->capabilities & ACPI_TAD_RT)
                sysfs_remove_group(&dev->kobj, &acpi_tad_time_attr_group);
 
@@ -573,6 +571,8 @@ static void acpi_tad_remove(struct platform_device *pdev)
 
        sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group);
 
+       pm_runtime_get_noresume(dev);
+
        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) {
@@ -580,7 +580,8 @@ static void acpi_tad_remove(struct platform_device *pdev)
                acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
        }
 
-       pm_runtime_put_sync(dev);
+       pm_runtime_put_noidle(dev);
+       pm_runtime_suspend(dev);
        pm_runtime_disable(dev);
        acpi_remove_cmos_rtc_space_handler(handle);
 }