diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2015-12-23 16:59:55 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-01-01 18:29:35 -0500 |
commit | 600c395bf6c4e44ec831e850d7f93ce53d7373be (patch) | |
tree | 5fd394811a50f7edbcab38c06dde00c507475477 | |
parent | 74bf8efb5fa6e958d2d7c7917b8bb672085ec0c6 (diff) |
powercap: constify powercap_zone_ops and powercap_zone_constraint_ops structures
The powercap_zone_ops and powercap_zone_constraint_ops structures are never
modified, so declare them as const.
Most of the actual changes adjust indentation to accomodate the const
keyword.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/powercap/intel_rapl.c | 4 | ||||
-rw-r--r-- | drivers/powercap/powercap_sys.c | 18 | ||||
-rw-r--r-- | include/linux/powercap.h | 4 |
3 files changed, 13 insertions, 13 deletions
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 48747c28a43d..fa8c8e8eb9f2 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c | |||
@@ -388,7 +388,7 @@ static int get_domain_enable(struct powercap_zone *power_zone, bool *mode) | |||
388 | } | 388 | } |
389 | 389 | ||
390 | /* per RAPL domain ops, in the order of rapl_domain_type */ | 390 | /* per RAPL domain ops, in the order of rapl_domain_type */ |
391 | static struct powercap_zone_ops zone_ops[] = { | 391 | static const struct powercap_zone_ops zone_ops[] = { |
392 | /* RAPL_DOMAIN_PACKAGE */ | 392 | /* RAPL_DOMAIN_PACKAGE */ |
393 | { | 393 | { |
394 | .get_energy_uj = get_energy_counter, | 394 | .get_energy_uj = get_energy_counter, |
@@ -584,7 +584,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, | |||
584 | return ret; | 584 | return ret; |
585 | } | 585 | } |
586 | 586 | ||
587 | static struct powercap_zone_constraint_ops constraint_ops = { | 587 | static const struct powercap_zone_constraint_ops constraint_ops = { |
588 | .set_power_limit_uw = set_power_limit, | 588 | .set_power_limit_uw = set_power_limit, |
589 | .get_power_limit_uw = get_current_power_limit, | 589 | .get_power_limit_uw = get_current_power_limit, |
590 | .set_time_window_us = set_time_window, | 590 | .set_time_window_us = set_time_window, |
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c index 84419af16f77..14bde0db8c24 100644 --- a/drivers/powercap/powercap_sys.c +++ b/drivers/powercap/powercap_sys.c | |||
@@ -293,8 +293,8 @@ err_alloc: | |||
293 | } | 293 | } |
294 | 294 | ||
295 | static int create_constraints(struct powercap_zone *power_zone, | 295 | static int create_constraints(struct powercap_zone *power_zone, |
296 | int nr_constraints, | 296 | int nr_constraints, |
297 | struct powercap_zone_constraint_ops *const_ops) | 297 | const struct powercap_zone_constraint_ops *const_ops) |
298 | { | 298 | { |
299 | int i; | 299 | int i; |
300 | int ret = 0; | 300 | int ret = 0; |
@@ -492,13 +492,13 @@ static struct class powercap_class = { | |||
492 | }; | 492 | }; |
493 | 493 | ||
494 | struct powercap_zone *powercap_register_zone( | 494 | struct powercap_zone *powercap_register_zone( |
495 | struct powercap_zone *power_zone, | 495 | struct powercap_zone *power_zone, |
496 | struct powercap_control_type *control_type, | 496 | struct powercap_control_type *control_type, |
497 | const char *name, | 497 | const char *name, |
498 | struct powercap_zone *parent, | 498 | struct powercap_zone *parent, |
499 | const struct powercap_zone_ops *ops, | 499 | const struct powercap_zone_ops *ops, |
500 | int nr_constraints, | 500 | int nr_constraints, |
501 | struct powercap_zone_constraint_ops *const_ops) | 501 | const struct powercap_zone_constraint_ops *const_ops) |
502 | { | 502 | { |
503 | int result; | 503 | int result; |
504 | int nr_attrs; | 504 | int nr_attrs; |
diff --git a/include/linux/powercap.h b/include/linux/powercap.h index 4e250417ee30..f0a4e6257dcc 100644 --- a/include/linux/powercap.h +++ b/include/linux/powercap.h | |||
@@ -208,7 +208,7 @@ struct powercap_zone_constraint_ops { | |||
208 | struct powercap_zone_constraint { | 208 | struct powercap_zone_constraint { |
209 | int id; | 209 | int id; |
210 | struct powercap_zone *power_zone; | 210 | struct powercap_zone *power_zone; |
211 | struct powercap_zone_constraint_ops *ops; | 211 | const struct powercap_zone_constraint_ops *ops; |
212 | }; | 212 | }; |
213 | 213 | ||
214 | 214 | ||
@@ -309,7 +309,7 @@ struct powercap_zone *powercap_register_zone( | |||
309 | struct powercap_zone *parent, | 309 | struct powercap_zone *parent, |
310 | const struct powercap_zone_ops *ops, | 310 | const struct powercap_zone_ops *ops, |
311 | int nr_constraints, | 311 | int nr_constraints, |
312 | struct powercap_zone_constraint_ops *const_ops); | 312 | const struct powercap_zone_constraint_ops *const_ops); |
313 | 313 | ||
314 | /** | 314 | /** |
315 | * powercap_unregister_zone() - Unregister a zone device | 315 | * powercap_unregister_zone() - Unregister a zone device |