From: Can Peng <pengcan@kylinos.cn>
To: daniel.lezcano@kernel.org, rafael@kernel.org, heiko@sntech.de
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, Can Peng <pengcan@kylinos.cn>
Subject: [PATCH] powercap: dtpm: constify OF match table
Date: Wed, 15 Jul 2026 15:15:59 +0800 [thread overview]
Message-ID: <20260715071559.202016-1-pengcan@kylinos.cn> (raw)
dtpm_create_hierarchy() only passes the OF match table to
of_machine_get_match_data(), which already takes a const struct
of_device_id pointer. The DTPM code does not modify the table.
Make the DTPM API const-correct and mark the Rockchip match table const as
well. This documents the read-only contract and allows the table to live
in read-only init data.
No functional change.
Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
drivers/powercap/dtpm.c | 2 +-
drivers/soc/rockchip/dtpm.c | 2 +-
include/linux/dtpm.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index b7a65e543f19..0a503dc38eb9 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -546,7 +546,7 @@ static int dtpm_for_each_child(const struct dtpm_node *hierarchy,
* Return: zero on success, a negative value in case of error. Errors
* are reported back from the underlying functions.
*/
-int dtpm_create_hierarchy(struct of_device_id *dtpm_match_table)
+int dtpm_create_hierarchy(const struct of_device_id *dtpm_match_table)
{
const struct dtpm_node *hierarchy;
int i, ret;
diff --git a/drivers/soc/rockchip/dtpm.c b/drivers/soc/rockchip/dtpm.c
index b36d4f752c30..6f1ad9b24289 100644
--- a/drivers/soc/rockchip/dtpm.c
+++ b/drivers/soc/rockchip/dtpm.c
@@ -41,7 +41,7 @@ static struct dtpm_node __initdata rk3399_hierarchy[] = {
[9] = { /* sentinel */ }
};
-static struct of_device_id __initdata rockchip_dtpm_match_table[] = {
+static const struct of_device_id rockchip_dtpm_match_table[] __initconst = {
{ .compatible = "rockchip,rk3399", .data = rk3399_hierarchy },
{},
};
diff --git a/include/linux/dtpm.h b/include/linux/dtpm.h
index a4a13514b730..05993a55138e 100644
--- a/include/linux/dtpm.h
+++ b/include/linux/dtpm.h
@@ -67,7 +67,7 @@ void dtpm_unregister(struct dtpm *dtpm);
int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent);
-int dtpm_create_hierarchy(struct of_device_id *dtpm_match_table);
+int dtpm_create_hierarchy(const struct of_device_id *dtpm_match_table);
void dtpm_destroy_hierarchy(void);
#endif
--
2.53.0
reply other threads:[~2026-07-15 7:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260715071559.202016-1-pengcan@kylinos.cn \
--to=pengcan@kylinos.cn \
--cc=daniel.lezcano@kernel.org \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.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