From: Eric Chan <ericchancf@google.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Sudeep Holla <sudeep.holla@kernel.org>,
coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Eric Chan <ericchancf@google.com>
Subject: [PATCH 2/2] coresight: Switch to DEFINE_RUNTIME_DEV_PM_OPS()
Date: Thu, 10 Sep 2026 14:51:07 +0000 [thread overview]
Message-ID: <20260910145107.3640991-3-ericchancf@google.com> (raw)
In-Reply-To: <20260910145107.3640991-1-ericchancf@google.com>
According to Documentation/power/runtime_pm.rst and
include/linux/pm_runtime.h, modern drivers are encouraged to use
DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() to simplify runtime PM ops
definitions and eliminate unnecessary #ifdef CONFIG_PM guards.
Convert the CoreSight TMC, CATU, and ETM4x drivers to use
DEFINE_RUNTIME_DEV_PM_OPS() and replace direct references to their
dev_pm_ops structures with pm_ptr(). This removes the #ifdef CONFIG_PM
blocks around the runtime suspend and resume callbacks, allowing the
compiler to always validate them regardless of CONFIG_PM.
Signed-off-by: Eric Chan <ericchancf@google.com>
---
drivers/hwtracing/coresight/coresight-catu.c | 12 +++++-------
drivers/hwtracing/coresight/coresight-etm4x-core.c | 11 ++++-------
drivers/hwtracing/coresight/coresight-tmc-core.c | 12 ++++--------
3 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c
index d9a12d5e48fa..e3bbfb707f73 100644
--- a/drivers/hwtracing/coresight/coresight-catu.c
+++ b/drivers/hwtracing/coresight/coresight-catu.c
@@ -14,6 +14,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include "coresight-catu.h"
@@ -640,7 +641,6 @@ static void catu_platform_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
}
-#ifdef CONFIG_PM
static int catu_runtime_suspend(struct device *dev)
{
struct catu_drvdata *drvdata = dev_get_drvdata(dev);
@@ -666,11 +666,9 @@ static int catu_runtime_resume(struct device *dev)
return ret;
}
-#endif
-static const struct dev_pm_ops catu_dev_pm_ops = {
- SET_RUNTIME_PM_OPS(catu_runtime_suspend, catu_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(catu_dev_pm_ops,
+ catu_runtime_suspend, catu_runtime_resume, NULL);
#ifdef CONFIG_ACPI
static const struct acpi_device_id catu_acpi_ids[] = {
@@ -688,14 +686,14 @@ static struct platform_driver catu_platform_driver = {
.name = "coresight-catu-platform",
.acpi_match_table = ACPI_PTR(catu_acpi_ids),
.suppress_bind_attrs = true,
- .pm = &catu_dev_pm_ops,
+ .pm = pm_ptr(&catu_dev_pm_ops),
},
};
static struct amba_driver catu_driver = {
.drv = {
.name = "coresight-catu",
- .pm = &catu_dev_pm_ops,
+ .pm = pm_ptr(&catu_dev_pm_ops),
.suppress_bind_attrs = true,
},
.probe = catu_probe,
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index ace5e077a10c..ef664a84120f 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -2460,7 +2460,6 @@ static const struct amba_id etm4_ids[] = {
MODULE_DEVICE_TABLE(amba, etm4_ids);
-#ifdef CONFIG_PM
static int etm4_runtime_suspend(struct device *dev)
{
struct etmv4_drvdata *drvdata = dev_get_drvdata(dev);
@@ -2486,11 +2485,9 @@ static int etm4_runtime_resume(struct device *dev)
return ret;
}
-#endif
-static const struct dev_pm_ops etm4_dev_pm_ops = {
- SET_RUNTIME_PM_OPS(etm4_runtime_suspend, etm4_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(etm4_dev_pm_ops,
+ etm4_runtime_suspend, etm4_runtime_resume, NULL);
static const struct of_device_id etm4_sysreg_match[] = {
{ .compatible = "arm,coresight-etm4x-sysreg" },
@@ -2514,14 +2511,14 @@ static struct platform_driver etm4_platform_driver = {
.of_match_table = etm4_sysreg_match,
.acpi_match_table = ACPI_PTR(etm4x_acpi_ids),
.suppress_bind_attrs = true,
- .pm = &etm4_dev_pm_ops,
+ .pm = pm_ptr(&etm4_dev_pm_ops),
},
};
static struct amba_driver etm4x_amba_driver = {
.drv = {
.name = "coresight-etm4x",
- .pm = &etm4_dev_pm_ops,
+ .pm = pm_ptr(&etm4_dev_pm_ops),
.suppress_bind_attrs = true,
},
.probe = etm4_probe_amba,
diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
index ece2e8c9be26..77588d53e1b0 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-core.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
@@ -980,8 +980,6 @@ static void tmc_platform_remove(struct platform_device *pdev)
__tmc_remove(&pdev->dev);
pm_runtime_disable(&pdev->dev);
}
-
-#ifdef CONFIG_PM
static int tmc_runtime_suspend(struct device *dev)
{
struct tmc_drvdata *drvdata = dev_get_drvdata(dev);
@@ -1007,11 +1005,9 @@ static int tmc_runtime_resume(struct device *dev)
return ret;
}
-#endif
-static const struct dev_pm_ops tmc_dev_pm_ops = {
- SET_RUNTIME_PM_OPS(tmc_runtime_suspend, tmc_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(tmc_dev_pm_ops,
+ tmc_runtime_suspend, tmc_runtime_resume, NULL);
#ifdef CONFIG_ACPI
static const struct acpi_device_id tmc_acpi_ids[] = {
@@ -1029,14 +1025,14 @@ static struct platform_driver tmc_platform_driver = {
.name = "coresight-tmc-platform",
.acpi_match_table = ACPI_PTR(tmc_acpi_ids),
.suppress_bind_attrs = true,
- .pm = &tmc_dev_pm_ops,
+ .pm = pm_ptr(&tmc_dev_pm_ops),
},
};
static struct amba_driver tmc_driver = {
.drv = {
.name = "coresight-tmc",
- .pm = &tmc_dev_pm_ops,
+ .pm = pm_ptr(&tmc_dev_pm_ops),
.suppress_bind_attrs = true,
},
.probe = tmc_probe,
--
2.55.0.1003.g10538fe699-goog
prev parent reply other threads:[~2026-09-10 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 14:51 [PATCH 0/2] coresight: Fix missing AMBA dev_pm_ops and modernize PM ops Eric Chan
2026-09-10 14:51 ` [PATCH 1/2] coresight: Add missing dev_pm_ops to AMBA drivers Eric Chan
2026-09-10 14:51 ` Eric Chan [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=20260910145107.3640991-3-ericchancf@google.com \
--to=ericchancf@google.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=suzuki.poulose@arm.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
all inboxes | Powered by JetHome®