diff mbox series

[1/2] powercap/drivers/dtpm: Constify powercap_zone_{,constraint_}ops

Message ID 20211202143734.101760-2-rikard.falkeborn@gmail.com (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series powercap/drivers/dtpm: Constify static ops structs | expand

Commit Message

Rikard Falkeborn Dec. 2, 2021, 2:37 p.m. UTC
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@gmail.com>
---
 drivers/powercap/dtpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

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,