[PATCH] cpufreq: sparc: Don't mark cpufreq callbacks with __init

Viresh Kumar posted 1 patch 2 years, 7 months ago
drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +-
drivers/cpufreq/sparc-us3-cpufreq.c  | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] cpufreq: sparc: Don't mark cpufreq callbacks with __init
Posted by Viresh Kumar 2 years, 7 months ago
These callbacks can be called again by the cpufreq core after the driver
is initialized and must be kept around. We currently get section
mismatch build warnings.

Don't mark them with __init.

Fixes: dcfce7c2cee4 ("cpufreq: sparc: Don't allocate cpufreq_driver dynamically")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Rafael,

Please apply this for -rc2. Thanks.

 drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +-
 drivers/cpufreq/sparc-us3-cpufreq.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/sparc-us2e-cpufreq.c b/drivers/cpufreq/sparc-us2e-cpufreq.c
index d3510cfdb3eb..2783d3d55fce 100644
--- a/drivers/cpufreq/sparc-us2e-cpufreq.c
+++ b/drivers/cpufreq/sparc-us2e-cpufreq.c
@@ -269,7 +269,7 @@ static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index)
 	return smp_call_function_single(cpu, __us2e_freq_target, &index, 1);
 }
 
-static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
+static int us2e_freq_cpu_init(struct cpufreq_policy *policy)
 {
 	unsigned int cpu = policy->cpu;
 	unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c
index 91d1ed558136..6c3657679a88 100644
--- a/drivers/cpufreq/sparc-us3-cpufreq.c
+++ b/drivers/cpufreq/sparc-us3-cpufreq.c
@@ -117,7 +117,7 @@ static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index)
 	return smp_call_function_single(cpu, update_safari_cfg, &new_bits, 1);
 }
 
-static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
+static int us3_freq_cpu_init(struct cpufreq_policy *policy)
 {
 	unsigned int cpu = policy->cpu;
 	unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
-- 
2.31.1.272.g89b43f80a514
Re: [PATCH] cpufreq: sparc: Don't mark cpufreq callbacks with __init
Posted by Randy Dunlap 2 years, 7 months ago

On 7/11/23 20:58, Viresh Kumar wrote:
> These callbacks can be called again by the cpufreq core after the driver
> is initialized and must be kept around. We currently get section
> mismatch build warnings.
> 
> Don't mark them with __init.
> 
> Fixes: dcfce7c2cee4 ("cpufreq: sparc: Don't allocate cpufreq_driver dynamically")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>


Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
> Rafael,
> 
> Please apply this for -rc2. Thanks.
> 
>  drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +-
>  drivers/cpufreq/sparc-us3-cpufreq.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/sparc-us2e-cpufreq.c b/drivers/cpufreq/sparc-us2e-cpufreq.c
> index d3510cfdb3eb..2783d3d55fce 100644
> --- a/drivers/cpufreq/sparc-us2e-cpufreq.c
> +++ b/drivers/cpufreq/sparc-us2e-cpufreq.c
> @@ -269,7 +269,7 @@ static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index)
>  	return smp_call_function_single(cpu, __us2e_freq_target, &index, 1);
>  }
>  
> -static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
> +static int us2e_freq_cpu_init(struct cpufreq_policy *policy)
>  {
>  	unsigned int cpu = policy->cpu;
>  	unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
> diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c
> index 91d1ed558136..6c3657679a88 100644
> --- a/drivers/cpufreq/sparc-us3-cpufreq.c
> +++ b/drivers/cpufreq/sparc-us3-cpufreq.c
> @@ -117,7 +117,7 @@ static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index)
>  	return smp_call_function_single(cpu, update_safari_cfg, &new_bits, 1);
>  }
>  
> -static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
> +static int us3_freq_cpu_init(struct cpufreq_policy *policy)
>  {
>  	unsigned int cpu = policy->cpu;
>  	unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;

-- 
~Randy
Re: [PATCH] cpufreq: sparc: Don't mark cpufreq callbacks with __init
Posted by Rafael J. Wysocki 2 years, 7 months ago
On Wed, Jul 12, 2023 at 5:58 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> These callbacks can be called again by the cpufreq core after the driver
> is initialized and must be kept around. We currently get section
> mismatch build warnings.
>
> Don't mark them with __init.
>
> Fixes: dcfce7c2cee4 ("cpufreq: sparc: Don't allocate cpufreq_driver dynamically")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Rafael,
>
> Please apply this for -rc2. Thanks.

Done, thanks!

>  drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +-
>  drivers/cpufreq/sparc-us3-cpufreq.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/sparc-us2e-cpufreq.c b/drivers/cpufreq/sparc-us2e-cpufreq.c
> index d3510cfdb3eb..2783d3d55fce 100644
> --- a/drivers/cpufreq/sparc-us2e-cpufreq.c
> +++ b/drivers/cpufreq/sparc-us2e-cpufreq.c
> @@ -269,7 +269,7 @@ static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index)
>         return smp_call_function_single(cpu, __us2e_freq_target, &index, 1);
>  }
>
> -static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
> +static int us2e_freq_cpu_init(struct cpufreq_policy *policy)
>  {
>         unsigned int cpu = policy->cpu;
>         unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
> diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c
> index 91d1ed558136..6c3657679a88 100644
> --- a/drivers/cpufreq/sparc-us3-cpufreq.c
> +++ b/drivers/cpufreq/sparc-us3-cpufreq.c
> @@ -117,7 +117,7 @@ static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index)
>         return smp_call_function_single(cpu, update_safari_cfg, &new_bits, 1);
>  }
>
> -static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
> +static int us3_freq_cpu_init(struct cpufreq_policy *policy)
>  {
>         unsigned int cpu = policy->cpu;
>         unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
> --