linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend
@ 2016-04-18  7:59 Jia Hongtao
  2016-04-18  7:59 ` [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined Jia Hongtao
  2016-04-18 10:32 ` [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Viresh Kumar
  0 siblings, 2 replies; 6+ messages in thread
From: Jia Hongtao @ 2016-04-18  7:59 UTC (permalink / raw)
  To: viresh.kumar, linux-pm
  Cc: linuxppc-dev, scott.wood, yuantian.tang, hongtao.jia

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. Stop_cpu callback is invoked during suspend
(Disabling non-boot cpus). So matchable unregistration is added to fix
this issue.

Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
---
 drivers/cpufreq/qoriq-cpufreq.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index b23e525..1c2fdc1 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -305,6 +305,7 @@ static int __exit 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);
@@ -323,6 +324,12 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy,
 	return clk_set_parent(policy->clk, parent);
 }
 
+static void qoriq_cpufreq_stop_cpu(struct cpufreq_policy *policy)
+{
+	struct cpu_data *cpud = policy->driver_data;
+
+	cpufreq_cooling_unregister(cpud->cdev);
+}
 
 static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
 {
@@ -352,6 +359,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
 	.verify		= cpufreq_generic_frequency_table_verify,
 	.target_index	= qoriq_cpufreq_target,
 	.get		= cpufreq_generic_get,
+	.stop_cpu	= qoriq_cpufreq_stop_cpu,
 	.ready		= qoriq_cpufreq_ready,
 	.attr		= cpufreq_generic_attr,
 };
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined
  2016-04-18  7:59 [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Jia Hongtao
@ 2016-04-18  7:59 ` Jia Hongtao
  2016-04-18 10:33   ` Viresh Kumar
  2016-04-18 10:32 ` [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Viresh Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: Jia Hongtao @ 2016-04-18  7:59 UTC (permalink / raw)
  To: viresh.kumar, linux-pm
  Cc: hongtao.jia, yuantian.tang, linuxppc-dev, scott.wood

When THERMAL_OF is undefined the cooling device messages should not be
shown. -ENOSYS is returned from of_cpufreq_cooling_register() when
THERMAL_OF is undefined.

Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
---
 drivers/cpufreq/qoriq-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index 1c2fdc1..ff8da83 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -340,8 +340,8 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
 		cpud->cdev = of_cpufreq_cooling_register(np,
 							 policy->related_cpus);
 
-		if (IS_ERR(cpud->cdev)) {
-			pr_err("Failed to register cooling device cpu%d: %ld\n",
+		if (IS_ERR(cpud->cdev) && PTR_ERR(cpud->cdev) != -ENOSYS) {
+			pr_err("cpu%d is not running as cooling device: %ld\n",
 					policy->cpu, PTR_ERR(cpud->cdev));
 
 			cpud->cdev = NULL;
-- 
2.1.0.27.g96db324

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend
  2016-04-18  7:59 [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Jia Hongtao
  2016-04-18  7:59 ` [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined Jia Hongtao
@ 2016-04-18 10:32 ` Viresh Kumar
  2016-04-19  6:52   ` 答复: " Hongtao Jia
  1 sibling, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2016-04-18 10:32 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: linux-pm, linuxppc-dev, scott.wood, yuantian.tang

On 18-04-16, 15:59, 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. Stop_cpu callback is invoked during suspend
> (Disabling non-boot cpus). So matchable unregistration is added to fix
> this issue.
> 
> Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
> ---
>  drivers/cpufreq/qoriq-cpufreq.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
> index b23e525..1c2fdc1 100644
> --- a/drivers/cpufreq/qoriq-cpufreq.c
> +++ b/drivers/cpufreq/qoriq-cpufreq.c
> @@ -305,6 +305,7 @@ static int __exit 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);
> @@ -323,6 +324,12 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy,
>  	return clk_set_parent(policy->clk, parent);
>  }
>  
> +static void qoriq_cpufreq_stop_cpu(struct cpufreq_policy *policy)
> +{
> +	struct cpu_data *cpud = policy->driver_data;
> +
> +	cpufreq_cooling_unregister(cpud->cdev);
> +}
>  
>  static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
>  {
> @@ -352,6 +359,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
>  	.verify		= cpufreq_generic_frequency_table_verify,
>  	.target_index	= qoriq_cpufreq_target,
>  	.get		= cpufreq_generic_get,
> +	.stop_cpu	= qoriq_cpufreq_stop_cpu,
>  	.ready		= qoriq_cpufreq_ready,
>  	.attr		= cpufreq_generic_attr,
>  };

You don't need to do it from stop_cpu(), please use
qoriq_cpufreq_cpu_exit() for this.

-- 
viresh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined
  2016-04-18  7:59 ` [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined Jia Hongtao
@ 2016-04-18 10:33   ` Viresh Kumar
  2016-04-26  0:02     ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2016-04-18 10:33 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: linux-pm, linuxppc-dev, scott.wood, yuantian.tang

On 18-04-16, 15:59, Jia Hongtao wrote:
> When THERMAL_OF is undefined the cooling device messages should not be
> shown. -ENOSYS is returned from of_cpufreq_cooling_register() when
> THERMAL_OF is undefined.
> 
> Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
> ---
>  drivers/cpufreq/qoriq-cpufreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
> index 1c2fdc1..ff8da83 100644
> --- a/drivers/cpufreq/qoriq-cpufreq.c
> +++ b/drivers/cpufreq/qoriq-cpufreq.c
> @@ -340,8 +340,8 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
>  		cpud->cdev = of_cpufreq_cooling_register(np,
>  							 policy->related_cpus);
>  
> -		if (IS_ERR(cpud->cdev)) {
> -			pr_err("Failed to register cooling device cpu%d: %ld\n",
> +		if (IS_ERR(cpud->cdev) && PTR_ERR(cpud->cdev) != -ENOSYS) {
> +			pr_err("cpu%d is not running as cooling device: %ld\n",
>  					policy->cpu, PTR_ERR(cpud->cdev));
>  
>  			cpud->cdev = NULL;

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* 答复: [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend
  2016-04-18 10:32 ` [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Viresh Kumar
@ 2016-04-19  6:52   ` Hongtao Jia
  0 siblings, 0 replies; 6+ messages in thread
From: Hongtao Jia @ 2016-04-19  6:52 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Yuantian Tang, Scott Wood, linuxppc-dev@lists.ozlabs.org,
	linux-pm@vger.kernel.org



> -----邮件原件-----
> 发件人: Viresh Kumar [mailto:viresh.kumar@linaro.org]
> 发送时间: Monday, April 18, 2016 6:33 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 1/2] cpufreq: qoriq: Fix cooling device registration issue
> during suspend
> 
> On 18-04-16, 15:59, 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. Stop_cpu callback is
> > invoked during suspend (Disabling non-boot cpus). So matchable
> > unregistration is added to fix this issue.
> >
> > Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
> > ---
> >  drivers/cpufreq/qoriq-cpufreq.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/cpufreq/qoriq-cpufreq.c
> > b/drivers/cpufreq/qoriq-cpufreq.c index b23e525..1c2fdc1 100644
> > --- a/drivers/cpufreq/qoriq-cpufreq.c
> > +++ b/drivers/cpufreq/qoriq-cpufreq.c
> > @@ -305,6 +305,7 @@ static int __exit 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);
> > @@ -323,6 +324,12 @@ static int qoriq_cpufreq_target(struct cpufreq_policy
> *policy,
> >  	return clk_set_parent(policy->clk, parent);  }
> >
> > +static void qoriq_cpufreq_stop_cpu(struct cpufreq_policy *policy) {
> > +	struct cpu_data *cpud = policy->driver_data;
> > +
> > +	cpufreq_cooling_unregister(cpud->cdev);
> > +}
> >
> >  static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)  { @@
> > -352,6 +359,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
> >  	.verify		= cpufreq_generic_frequency_table_verify,
> >  	.target_index	= qoriq_cpufreq_target,
> >  	.get		= cpufreq_generic_get,
> > +	.stop_cpu	= qoriq_cpufreq_stop_cpu,
> >  	.ready		= qoriq_cpufreq_ready,
> >  	.attr		= cpufreq_generic_attr,
> >  };
> 
> You don't need to do it from stop_cpu(), please use
> qoriq_cpufreq_cpu_exit() for this.

Thanks. The new patch will be submitted soon.

-Hongtao.

> 
> --
> viresh
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined
  2016-04-18 10:33   ` Viresh Kumar
@ 2016-04-26  0:02     ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2016-04-26  0:02 UTC (permalink / raw)
  To: Viresh Kumar, Jia Hongtao
  Cc: linux-pm, linuxppc-dev, scott.wood, yuantian.tang

On Monday, April 18, 2016 04:03:45 PM Viresh Kumar wrote:
> On 18-04-16, 15:59, Jia Hongtao wrote:
> > When THERMAL_OF is undefined the cooling device messages should not be
> > shown. -ENOSYS is returned from of_cpufreq_cooling_register() when
> > THERMAL_OF is undefined.
> > 
> > Signed-off-by: Jia Hongtao <hongtao.jia@nxp.com>
> > ---
> >  drivers/cpufreq/qoriq-cpufreq.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
> > index 1c2fdc1..ff8da83 100644
> > --- a/drivers/cpufreq/qoriq-cpufreq.c
> > +++ b/drivers/cpufreq/qoriq-cpufreq.c
> > @@ -340,8 +340,8 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
> >  		cpud->cdev = of_cpufreq_cooling_register(np,
> >  							 policy->related_cpus);
> >  
> > -		if (IS_ERR(cpud->cdev)) {
> > -			pr_err("Failed to register cooling device cpu%d: %ld\n",
> > +		if (IS_ERR(cpud->cdev) && PTR_ERR(cpud->cdev) != -ENOSYS) {
> > +			pr_err("cpu%d is not running as cooling device: %ld\n",
> >  					policy->cpu, PTR_ERR(cpud->cdev));
> >  
> >  			cpud->cdev = NULL;
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied, thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-25 23:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18  7:59 [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Jia Hongtao
2016-04-18  7:59 ` [PATCH 2/2] cpufreq: qoriq: Don't show cooling device messages if THERMAL_OF undefined Jia Hongtao
2016-04-18 10:33   ` Viresh Kumar
2016-04-26  0:02     ` Rafael J. Wysocki
2016-04-18 10:32 ` [PATCH 1/2] cpufreq: qoriq: Fix cooling device registration issue during suspend Viresh Kumar
2016-04-19  6:52   ` 答复: " Hongtao Jia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).