* [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static
@ 2022-11-03 14:36 Colin Ian King
2022-11-03 14:38 ` Viresh Kumar
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Colin Ian King @ 2022-11-03 14:36 UTC (permalink / raw)
To: Rafael J . Wysocki, Viresh Kumar, linux-pm; +Cc: kernel-janitors, linux-kernel
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 <colin.i.king@gmail.com>
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static
2022-11-03 14:36 [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static Colin Ian King
@ 2022-11-03 14:38 ` Viresh Kumar
2022-11-03 14:49 ` Colin King (gmail)
2022-11-03 18:16 ` Rafael J. Wysocki
2022-11-04 4:51 ` Joe Perches
2 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2022-11-03 14:38 UTC (permalink / raw)
To: Colin Ian King
Cc: Rafael J . Wysocki, linux-pm, kernel-janitors, linux-kernel
On 03-11-22, 14:36, 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.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> 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",
Same questions from longhaul patch apply here too.
--
viresh
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static
2022-11-03 14:38 ` Viresh Kumar
@ 2022-11-03 14:49 ` Colin King (gmail)
2022-11-04 4:40 ` Viresh Kumar
0 siblings, 1 reply; 6+ messages in thread
From: Colin King (gmail) @ 2022-11-03 14:49 UTC (permalink / raw)
To: Viresh Kumar; +Cc: Rafael J . Wysocki, linux-pm, kernel-janitors, linux-kernel
On 03/11/2022 14:38, Viresh Kumar wrote:
> On 03-11-22, 14:36, 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.
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>> 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",
>
> Same questions from longhaul patch apply here too.
>
See answer in that patch :-)
But really, this is kind of basic C level stuff. I suggest reading K&R
2nd Edition, Section 4.6, last paragraph before exercise 4-11.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static
2022-11-03 14:49 ` Colin King (gmail)
@ 2022-11-04 4:40 ` Viresh Kumar
0 siblings, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2022-11-04 4:40 UTC (permalink / raw)
To: Colin King (gmail)
Cc: Rafael J . Wysocki, linux-pm, kernel-janitors, linux-kernel
On 03-11-22, 14:49, Colin King (gmail) wrote:
> But really, this is kind of basic C level stuff. I suggest reading K&R 2nd
> Edition, Section 4.6, last paragraph before exercise 4-11.
Yeah it is and I said this for the benefit of later readers of the commit log,
who may not know the exact reason of the same:
"I am just looking for a valid answer in commit log".
Anyway, the patches look fine otherwise.
--
viresh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static
2022-11-03 14:36 [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static Colin Ian King
2022-11-03 14:38 ` Viresh Kumar
@ 2022-11-03 18:16 ` Rafael J. Wysocki
2022-11-04 4:51 ` Joe Perches
2 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-11-03 18:16 UTC (permalink / raw)
To: Colin Ian King
Cc: Rafael J . Wysocki, Viresh Kumar, linux-pm, kernel-janitors,
linux-kernel
On Thu, Nov 3, 2022 at 3:37 PM Colin Ian King <colin.i.king@gmail.com> 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 <colin.i.king@gmail.com>
> ---
> 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!
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static
2022-11-03 14:36 [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static Colin Ian King
2022-11-03 14:38 ` Viresh Kumar
2022-11-03 18:16 ` Rafael J. Wysocki
@ 2022-11-04 4:51 ` Joe Perches
2 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2022-11-04 4:51 UTC (permalink / raw)
To: Colin Ian King, Rafael J . Wysocki, Viresh Kumar, linux-pm
Cc: kernel-janitors, linux-kernel
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-04 4:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 14:36 [PATCH] cpufreq: SPEAr: Make read-only array sys_clk_src static Colin Ian King
2022-11-03 14:38 ` Viresh Kumar
2022-11-03 14:49 ` Colin King (gmail)
2022-11-04 4:40 ` Viresh Kumar
2022-11-03 18:16 ` Rafael J. Wysocki
2022-11-04 4:51 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®