2022-11-03 14:54:32

by Colin Ian King

[permalink] [raw]
Subject: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static

Don't populate the read-only array sys_clk_src on the stack but instead
make it static and add in a missing const. Also makes the object code a
little smaller.

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/cpufreq/spear-cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index 7d0d62a06bf3..c6fdf019dbde 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -39,7 +39,7 @@ static struct clk *spear1340_cpu_get_possible_parent(unsigned long newfreq)
* In SPEAr1340, cpu clk's parent sys clk can take input from
* following sources
*/
- const char *sys_clk_src[] = {
+ static const char * const sys_clk_src[] = {
"sys_syn_clk",
"pll1_clk",
"pll2_clk",
--
2.38.1



2022-11-03 18:35:39

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static

On Thu, Nov 3, 2022 at 3:37 PM Colin Ian King <[email protected]> wrote:
>
> Don't populate the read-only array sys_clk_src on the stack but instead
> make it static and add in a missing const. Also makes the object code a
> little smaller.
>
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/cpufreq/spear-cpufreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
> index 7d0d62a06bf3..c6fdf019dbde 100644
> --- a/drivers/cpufreq/spear-cpufreq.c
> +++ b/drivers/cpufreq/spear-cpufreq.c
> @@ -39,7 +39,7 @@ static struct clk *spear1340_cpu_get_possible_parent(unsigned long newfreq)
> * In SPEAr1340, cpu clk's parent sys clk can take input from
> * following sources
> */
> - const char *sys_clk_src[] = {
> + static const char * const sys_clk_src[] = {
> "sys_syn_clk",
> "pll1_clk",
> "pll2_clk",
> --

Applied as 6.2 material, thanks!

2022-11-04 05:26:23

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static

On Thu, 2022-11-03 at 14:36 +0000, Colin Ian King wrote:
> Don't populate the read-only array sys_clk_src on the stack but instead
> make it static and add in a missing const. Also makes the object code a
> little smaller.
[]
> diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
[]
> @@ -39,7 +39,7 @@ static struct clk *spear1340_cpu_get_possible_parent(unsigned long newfreq)
> * In SPEAr1340, cpu clk's parent sys clk can take input from
> * following sources
> */
> - const char *sys_clk_src[] = {
> + static const char * const sys_clk_src[] = {
> "sys_syn_clk",
> "pll1_clk",
> "pll2_clk",

sys_clk_src[2] isn't used and could be deleted with the
pclk indices changed.

Dunno what happened to the > 500000000 && != 600000000 range.