[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211202143734.101760-2-rikard.falkeborn@gmail.com>
Date: Thu, 2 Dec 2021 15:37:33 +0100
From: Rikard Falkeborn <rikard.falkeborn@...il.com>
To: Daniel Lezcano <daniel.lezcano@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Rikard Falkeborn <rikard.falkeborn@...il.com>
Subject: [PATCH 1/2] powercap/drivers/dtpm: Constify powercap_zone_{,constraint_}ops
These are only passed as input to powercap_register_zone() which takes
pointers to const powercap_zone_ops and powercap_zone_constraint_ops.
Make them const to allow the compiler to put them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@...il.com>
---
drivers/powercap/dtpm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index b9fac786246a..d7ac5e79fee1 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -341,7 +341,7 @@ static int get_max_power_uw(struct powercap_zone *pcz, int id, u64 *max_power)
return 0;
}
-static struct powercap_zone_constraint_ops constraint_ops = {
+static const struct powercap_zone_constraint_ops constraint_ops = {
.set_power_limit_uw = set_power_limit_uw,
.get_power_limit_uw = get_power_limit_uw,
.set_time_window_us = set_time_window_us,
@@ -350,7 +350,7 @@ static struct powercap_zone_constraint_ops constraint_ops = {
.get_name = get_constraint_name,
};
-static struct powercap_zone_ops zone_ops = {
+static const struct powercap_zone_ops zone_ops = {
.get_max_power_range_uw = get_max_power_range_uw,
.get_power_uw = get_power_uw,
.release = dtpm_release_zone,
--
2.34.1
Powered by blists - more mailing lists