linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const
@ 2017-10-19 10:59 Bhumika Goyal
  2017-10-19 10:59 ` [PATCH 1/2] cpufreq: arm_big_little: make function arguments and structure pointer const Bhumika Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-10-19 10:59 UTC (permalink / raw)
  To: linux-arm-kernel

Make some function arguments as const. After this change make the 
cpufreq_arm_bL_ops structures const.

Bhumika Goyal (2):
  cpufreq: arm_big_little: make function argument and structure const
  cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const

 drivers/cpufreq/arm_big_little.c       | 6 +++---
 drivers/cpufreq/arm_big_little.h       | 4 ++--
 drivers/cpufreq/arm_big_little_dt.c    | 2 +-
 drivers/cpufreq/scpi-cpufreq.c         | 2 +-
 drivers/cpufreq/vexpress-spc-cpufreq.c | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.9.1

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

* [PATCH 1/2] cpufreq: arm_big_little: make function arguments and structure pointer const
  2017-10-19 10:59 [PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const Bhumika Goyal
@ 2017-10-19 10:59 ` Bhumika Goyal
  2017-10-19 10:59 ` [PATCH 2/2] cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const Bhumika Goyal
  2017-10-26  3:03 ` [PATCH 0/2] cpufreq: arm_big_little: make function arguments and " Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-10-19 10:59 UTC (permalink / raw)
  To: linux-arm-kernel

Make the arguments of functions bL_cpufreq_{register/unregister} as
const as the ops pointer does not modify the fields of the
cpufreq_arm_bL_ops structure it points to. The pointer arm_bL_ops is
also getting initialized with ops but the pointer does not modify the
fields. So, make the function argument and the structure pointer const.
Add const to function prototypes too.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/cpufreq/arm_big_little.c | 6 +++---
 drivers/cpufreq/arm_big_little.h | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 0c41ab3..65ec5f0 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -57,7 +57,7 @@
 #define VIRT_FREQ(cluster, freq)    ((cluster == A7_CLUSTER) ? freq >> 1 : freq)
 
 static struct thermal_cooling_device *cdev[MAX_CLUSTERS];
-static struct cpufreq_arm_bL_ops *arm_bL_ops;
+static const struct cpufreq_arm_bL_ops *arm_bL_ops;
 static struct clk *clk[MAX_CLUSTERS];
 static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1];
 static atomic_t cluster_usage[MAX_CLUSTERS + 1];
@@ -617,7 +617,7 @@ static int __bLs_unregister_notifier(void)
 static int __bLs_unregister_notifier(void) { return 0; }
 #endif
 
-int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
+int bL_cpufreq_register(const struct cpufreq_arm_bL_ops *ops)
 {
 	int ret, i;
 
@@ -661,7 +661,7 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
 }
 EXPORT_SYMBOL_GPL(bL_cpufreq_register);
 
-void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops)
+void bL_cpufreq_unregister(const struct cpufreq_arm_bL_ops *ops)
 {
 	if (arm_bL_ops != ops) {
 		pr_err("%s: Registered with: %s, can't unregister, exiting\n",
diff --git a/drivers/cpufreq/arm_big_little.h b/drivers/cpufreq/arm_big_little.h
index 184d7c3..88a176e 100644
--- a/drivers/cpufreq/arm_big_little.h
+++ b/drivers/cpufreq/arm_big_little.h
@@ -37,7 +37,7 @@ struct cpufreq_arm_bL_ops {
 	void (*free_opp_table)(const struct cpumask *cpumask);
 };
 
-int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops);
-void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops);
+int bL_cpufreq_register(const struct cpufreq_arm_bL_ops *ops);
+void bL_cpufreq_unregister(const struct cpufreq_arm_bL_ops *ops);
 
 #endif /* CPUFREQ_ARM_BIG_LITTLE_H */
-- 
1.9.1

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

* [PATCH 2/2] cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const
  2017-10-19 10:59 [PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const Bhumika Goyal
  2017-10-19 10:59 ` [PATCH 1/2] cpufreq: arm_big_little: make function arguments and structure pointer const Bhumika Goyal
@ 2017-10-19 10:59 ` Bhumika Goyal
  2017-10-26  3:03 ` [PATCH 0/2] cpufreq: arm_big_little: make function arguments and " Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-10-19 10:59 UTC (permalink / raw)
  To: linux-arm-kernel

Make these const as they are only getting passed to the functions
bL_cpufreq_{register/unregister} having the arguments as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/cpufreq/arm_big_little_dt.c    | 2 +-
 drivers/cpufreq/scpi-cpufreq.c         | 2 +-
 drivers/cpufreq/vexpress-spc-cpufreq.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c
index 39b3f51..b944f29 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -61,7 +61,7 @@ static int dt_get_transition_latency(struct device *cpu_dev)
 	return transition_latency;
 }
 
-static struct cpufreq_arm_bL_ops dt_bL_ops = {
+static const struct cpufreq_arm_bL_ops dt_bL_ops = {
 	.name	= "dt-bl",
 	.get_transition_latency = dt_get_transition_latency,
 	.init_opp_table = dev_pm_opp_of_cpumask_add_table,
diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
index 8de2364..05d2990 100644
--- a/drivers/cpufreq/scpi-cpufreq.c
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -53,7 +53,7 @@ static int scpi_init_opp_table(const struct cpumask *cpumask)
 	return ret;
 }
 
-static struct cpufreq_arm_bL_ops scpi_cpufreq_ops = {
+static const struct cpufreq_arm_bL_ops scpi_cpufreq_ops = {
 	.name	= "scpi",
 	.get_transition_latency = scpi_get_transition_latency,
 	.init_opp_table = scpi_init_opp_table,
diff --git a/drivers/cpufreq/vexpress-spc-cpufreq.c b/drivers/cpufreq/vexpress-spc-cpufreq.c
index 87e5bdc..5323728 100644
--- a/drivers/cpufreq/vexpress-spc-cpufreq.c
+++ b/drivers/cpufreq/vexpress-spc-cpufreq.c
@@ -42,7 +42,7 @@ static int ve_spc_get_transition_latency(struct device *cpu_dev)
 	return 1000000; /* 1 ms */
 }
 
-static struct cpufreq_arm_bL_ops ve_spc_cpufreq_ops = {
+static const struct cpufreq_arm_bL_ops ve_spc_cpufreq_ops = {
 	.name	= "vexpress-spc",
 	.get_transition_latency = ve_spc_get_transition_latency,
 	.init_opp_table = ve_spc_init_opp_table,
-- 
1.9.1

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

* [PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const
  2017-10-19 10:59 [PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const Bhumika Goyal
  2017-10-19 10:59 ` [PATCH 1/2] cpufreq: arm_big_little: make function arguments and structure pointer const Bhumika Goyal
  2017-10-19 10:59 ` [PATCH 2/2] cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const Bhumika Goyal
@ 2017-10-26  3:03 ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2017-10-26  3:03 UTC (permalink / raw)
  To: linux-arm-kernel

On 19-10-17, 12:59, Bhumika Goyal wrote:
> Make some function arguments as const. After this change make the 
> cpufreq_arm_bL_ops structures const.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

end of thread, other threads:[~2017-10-26  3:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 10:59 [PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const Bhumika Goyal
2017-10-19 10:59 ` [PATCH 1/2] cpufreq: arm_big_little: make function arguments and structure pointer const Bhumika Goyal
2017-10-19 10:59 ` [PATCH 2/2] cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const Bhumika Goyal
2017-10-26  3:03 ` [PATCH 0/2] cpufreq: arm_big_little: make function arguments and " Viresh Kumar

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).