diff mbox

[V2] cpufreq: qoriq: Fix cooling device registration issue during suspend

Message ID 1461048206-23567-1-git-send-email-hongtao.jia@nxp.com (mailing list archive)
State Not Applicable
Delegated to: Scott Wood
Headers show

Commit Message

Hongtao Jia April 19, 2016, 6:43 a.m. UTC
Cooling device is registered by ready callback. It's also invoked while
system resuming from sleep (Enabling non-boot cpus). Thus cooling device
may be multiple registered. Matchable unregistration is added to exit
callback to fix this issue.

Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
---
Changes for V2:
* Using qoriq_cpufreq_cpu_exit() callback instead of adding stop_cpu().

 drivers/cpufreq/qoriq-cpufreq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Viresh Kumar April 19, 2016, 7:54 a.m. UTC | #1
On 19-04-16, 14:43, Jia Hongtao wrote:
> Cooling device is registered by ready callback. It's also invoked while
> system resuming from sleep (Enabling non-boot cpus). Thus cooling device
> may be multiple registered. Matchable unregistration is added to exit
> callback to fix this issue.
> 
> Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
> ---
> Changes for V2:
> * Using qoriq_cpufreq_cpu_exit() callback instead of adding stop_cpu().
> 
>  drivers/cpufreq/qoriq-cpufreq.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
> index b23e525..0b85f90 100644
> --- a/drivers/cpufreq/qoriq-cpufreq.c
> +++ b/drivers/cpufreq/qoriq-cpufreq.c
> @@ -301,10 +301,11 @@ err_np:
>  	return -ENODEV;
>  }
>  
> -static int __exit qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy)
> +static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy)

Yes, __exit should have been removed, but not in this patch to create confusion.
You should have submitted two separate patches for these changes.

>  {
>  	struct cpu_data *data = policy->driver_data;
>  
> +	cpufreq_cooling_unregister(data->cdev);
>  	kfree(data->pclk);
>  	kfree(data->table);
>  	kfree(data);
> @@ -348,7 +349,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
>  	.name		= "qoriq_cpufreq",
>  	.flags		= CPUFREQ_CONST_LOOPS,
>  	.init		= qoriq_cpufreq_cpu_init,
> -	.exit		= __exit_p(qoriq_cpufreq_cpu_exit),
> +	.exit		= qoriq_cpufreq_cpu_exit,
>  	.verify		= cpufreq_generic_frequency_table_verify,
>  	.target_index	= qoriq_cpufreq_target,
>  	.get		= cpufreq_generic_get,
> -- 
> 2.1.0.27.g96db324
Hongtao Jia April 19, 2016, 8:51 a.m. UTC | #2
> -----邮件原件-----

> 发件人: Viresh Kumar [mailto:viresh.kumar@linaro.org]

> 发送时间: Tuesday, April 19, 2016 3:54 PM

> 收件人: Hongtao Jia <hongtao.jia@nxp.com>

> 抄送: linux-pm@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; Scott Wood

> <scott.wood@nxp.com>; Yuantian Tang <yuantian.tang@nxp.com>

> 主题: Re: [PATCH V2] cpufreq: qoriq: Fix cooling device registration issue during

> suspend

> 

> On 19-04-16, 14:43, Jia Hongtao wrote:

> > Cooling device is registered by ready callback. It's also invoked

> > while system resuming from sleep (Enabling non-boot cpus). Thus

> > cooling device may be multiple registered. Matchable unregistration is

> > added to exit callback to fix this issue.

> >

> > Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>

> > ---

> > Changes for V2:

> > * Using qoriq_cpufreq_cpu_exit() callback instead of adding stop_cpu().

> >

> >  drivers/cpufreq/qoriq-cpufreq.c | 5 +++--

> >  1 file changed, 3 insertions(+), 2 deletions(-)

> >

> > diff --git a/drivers/cpufreq/qoriq-cpufreq.c

> > b/drivers/cpufreq/qoriq-cpufreq.c index b23e525..0b85f90 100644

> > --- a/drivers/cpufreq/qoriq-cpufreq.c

> > +++ b/drivers/cpufreq/qoriq-cpufreq.c

> > @@ -301,10 +301,11 @@ err_np:

> >  	return -ENODEV;

> >  }

> >

> > -static int __exit qoriq_cpufreq_cpu_exit(struct cpufreq_policy

> > *policy)

> > +static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy)

> 

> Yes, __exit should have been removed, but not in this patch to create

> confusion.

> You should have submitted two separate patches for these changes.


Thanks. I will send a new patch set soon.

> 

> >  {

> >  	struct cpu_data *data = policy->driver_data;

> >

> > +	cpufreq_cooling_unregister(data->cdev);

> >  	kfree(data->pclk);

> >  	kfree(data->table);

> >  	kfree(data);

> > @@ -348,7 +349,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {

> >  	.name		= "qoriq_cpufreq",

> >  	.flags		= CPUFREQ_CONST_LOOPS,

> >  	.init		= qoriq_cpufreq_cpu_init,

> > -	.exit		= __exit_p(qoriq_cpufreq_cpu_exit),

> > +	.exit		= qoriq_cpufreq_cpu_exit,

> >  	.verify		= cpufreq_generic_frequency_table_verify,

> >  	.target_index	= qoriq_cpufreq_target,

> >  	.get		= cpufreq_generic_get,

> > --

> > 2.1.0.27.g96db324

> 

> --

> viresh
diff mbox

Patch

diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index b23e525..0b85f90 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -301,10 +301,11 @@  err_np:
 	return -ENODEV;
 }
 
-static int __exit qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy)
+static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 {
 	struct cpu_data *data = policy->driver_data;
 
+	cpufreq_cooling_unregister(data->cdev);
 	kfree(data->pclk);
 	kfree(data->table);
 	kfree(data);
@@ -348,7 +349,7 @@  static struct cpufreq_driver qoriq_cpufreq_driver = {
 	.name		= "qoriq_cpufreq",
 	.flags		= CPUFREQ_CONST_LOOPS,
 	.init		= qoriq_cpufreq_cpu_init,
-	.exit		= __exit_p(qoriq_cpufreq_cpu_exit),
+	.exit		= qoriq_cpufreq_cpu_exit,
 	.verify		= cpufreq_generic_frequency_table_verify,
 	.target_index	= qoriq_cpufreq_target,
 	.get		= cpufreq_generic_get,