linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PowerCap: constify powercap_zone_ops and powercap_zone_constraint_ops structures
@ 2015-12-23 21:59 Julia Lawall
  2016-01-03  0:58 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2015-12-23 21:59 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: kernel-janitors, linux-pm, linux-kernel

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>

---
 drivers/powercap/intel_rapl.c   |    4 ++--
 drivers/powercap/powercap_sys.c |   18 +++++++++---------
 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 4099159..6c592dc 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)
 }
 
 /* per RAPL domain ops, in the order of rapl_domain_type */
-static struct powercap_zone_ops zone_ops[] = {
+static const struct powercap_zone_ops zone_ops[] = {
 	/* RAPL_DOMAIN_PACKAGE */
 	{
 		.get_energy_uj = get_energy_counter,
@@ -584,7 +584,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id,
 	return ret;
 }
 
-static struct powercap_zone_constraint_ops constraint_ops = {
+static const struct powercap_zone_constraint_ops constraint_ops = {
 	.set_power_limit_uw = set_power_limit,
 	.get_power_limit_uw = get_current_power_limit,
 	.set_time_window_us = set_time_window,
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index 84419af..14bde0d 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -293,8 +293,8 @@ err_alloc:
 }
 
 static int create_constraints(struct powercap_zone *power_zone,
-				int nr_constraints,
-				struct powercap_zone_constraint_ops *const_ops)
+			int nr_constraints,
+			const struct powercap_zone_constraint_ops *const_ops)
 {
 	int i;
 	int ret = 0;
@@ -492,13 +492,13 @@ static struct class powercap_class = {
 };
 
 struct powercap_zone *powercap_register_zone(
-				struct powercap_zone *power_zone,
-				struct powercap_control_type *control_type,
-				const char *name,
-				struct powercap_zone *parent,
-				const struct powercap_zone_ops *ops,
-				int nr_constraints,
-				struct powercap_zone_constraint_ops *const_ops)
+			struct powercap_zone *power_zone,
+			struct powercap_control_type *control_type,
+			const char *name,
+			struct powercap_zone *parent,
+			const struct powercap_zone_ops *ops,
+			int nr_constraints,
+			const struct powercap_zone_constraint_ops *const_ops)
 {
 	int result;
 	int nr_attrs;
diff --git a/include/linux/powercap.h b/include/linux/powercap.h
index 4e25041..f0a4e62 100644
--- a/include/linux/powercap.h
+++ b/include/linux/powercap.h
@@ -208,7 +208,7 @@ struct powercap_zone_constraint_ops {
 struct powercap_zone_constraint {
 	int id;
 	struct powercap_zone *power_zone;
-	struct powercap_zone_constraint_ops *ops;
+	const struct powercap_zone_constraint_ops *ops;
 };
 
 
@@ -309,7 +309,7 @@ struct powercap_zone *powercap_register_zone(
 			struct powercap_zone *parent,
 			const struct powercap_zone_ops *ops,
 			int nr_constraints,
-			struct powercap_zone_constraint_ops *const_ops);
+			const struct powercap_zone_constraint_ops *const_ops);
 
 /**
 * powercap_unregister_zone() - Unregister a zone device


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PowerCap: constify powercap_zone_ops and powercap_zone_constraint_ops structures
  2015-12-23 21:59 [PATCH] PowerCap: constify powercap_zone_ops and powercap_zone_constraint_ops structures Julia Lawall
@ 2016-01-03  0:58 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2016-01-03  0:58 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-pm, linux-kernel

On Wednesday, December 23, 2015 10:59:55 PM Julia Lawall wrote:
> 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>

Applied, thanks!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-03  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23 21:59 [PATCH] PowerCap: constify powercap_zone_ops and powercap_zone_constraint_ops structures Julia Lawall
2016-01-03  0:58 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).