cpufreq: arm_big_little: make function arguments and structures const
Subsystems (3)
cover cpufreq: arm_big_little: make function arguments and structures const
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(-)
Signature · 1 line
1.9.1
PATCH 1/2 cpufreq: arm_big_little: make function arguments and structure pointer const
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.
--- drivers/cpufreq/arm_big_little.c | 6 +++--- drivers/cpufreq/arm_big_little.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/cpufreq/arm_big_little.c +3 -3
@@ -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",
drivers/cpufreq/arm_big_little.h +2 -2
@@ -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 */
Signature · 1 line
1.9.1
PATCH 2/2 cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const
In reply to Bhumika GoyalMake these const as they are only getting passed to the functions bL_cpufreq_{register/unregister} having the arguments as const.
--- 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(-)
drivers/cpufreq/arm_big_little_dt.c +1 -1
@@ -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,
drivers/cpufreq/scpi-cpufreq.c +1 -1
@@ -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,
drivers/cpufreq/vexpress-spc-cpufreq.c +1 -1
@@ -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,
Signature · 1 line
1.9.1
Quoted 2 lines · Bhumika Goyal
Make some function arguments as const. After this change make the
cpufreq_arm_bL_opsstructures const.
Signature · 1 line
viresh