From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Takashi Iwai <tiwai@suse.de>, LKML <linux-kernel@vger.kernel.org>,
Zhang Qilong <zhangqilong3@huawei.com>,
Frank Li <Frank.Li@nxp.com>, Dhruva Gole <d-gole@ti.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH v2 1/2] ACPI: TAD: Rearrange runtime PM operations in acpi_tad_remove()
Date: Sat, 18 Oct 2025 14:23:07 +0200 [thread overview]
Message-ID: <2333453.iZASKD2KPV@rafael.j.wysocki> (raw)
In-Reply-To: <8599731.T7Z3S40VBb@rafael.j.wysocki>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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>
---
drivers/acpi/acpi_tad.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/drivers/acpi/acpi_tad.c
+++ b/drivers/acpi/acpi_tad.c
@@ -563,8 +563,6 @@ static void acpi_tad_remove(struct platf
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 platf
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 platf
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);
}
next prev parent reply other threads:[~2025-10-18 12:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 12:22 [PATCH v2 0/2] ACPI: TAD: Use auto-cleanup macros for runtime PM Rafael J. Wysocki
2025-10-18 12:23 ` Rafael J. Wysocki [this message]
2025-10-18 12:24 ` [PATCH v2 2/2] ACPI: TAD: Improve runtime PM using guard macros Rafael J. Wysocki
2025-10-20 15:11 ` Jonathan Cameron
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=2333453.iZASKD2KPV@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=d-gole@ti.com \
--cc=dan.j.williams@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=tiwai@suse.de \
--cc=zhangqilong3@huawei.com \
/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