linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PM / devfreq: Fix handling dev_pm_qos_remove_request result
@ 2020-03-12 15:36 ` Leonard Crestez
  2020-03-16  6:09   ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Leonard Crestez @ 2020-03-12 15:36 UTC (permalink / raw)
  To: Chanwoo Choi, dAN cARPENTER
  Cc: mYUNGjOO hAM, Kyungmin Park, Matthias Kaehlcke, Adam Ford,
	Krzysztof Kozlowski, Rafael J. Wysocki, Viresh Kumar, linux-imx,
	linux-pm, linux-arm-kernel

The dev_pm_qos_remove_request function can return 1 if
"aggregated constraint value has changed" so only negative values should
be reported as errors.

Fixes: 27dbc542f651 ("PM / devfreq: Use PM QoS for sysfs min/max_freq")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Cc: stable@vger.kernel.org
---
 drivers/devfreq/devfreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Changes since v1:
* Add fixes and cc: stable, drop empty line in message.
Link to v1: https://patchwork.kernel.org/patch/11433131/

I'm not sure this meet that stable kernel standard of "real bug that
bothers people" because all this fixes is a spurious dev_warn on device
removal. But Sasha Levin's script seem to collect a lot of low-priority
fixes anyway.

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 5c481ad1cfc7..6fecd11dafdd 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -703,17 +703,17 @@ static void devfreq_dev_release(struct device *dev)
 		dev_warn(dev->parent,
 			"Failed to remove min_freq notifier: %d\n", err);
 
 	if (dev_pm_qos_request_active(&devfreq->user_max_freq_req)) {
 		err = dev_pm_qos_remove_request(&devfreq->user_max_freq_req);
-		if (err)
+		if (err < 0)
 			dev_warn(dev->parent,
 				"Failed to remove max_freq request: %d\n", err);
 	}
 	if (dev_pm_qos_request_active(&devfreq->user_min_freq_req)) {
 		err = dev_pm_qos_remove_request(&devfreq->user_min_freq_req);
-		if (err)
+		if (err < 0)
 			dev_warn(dev->parent,
 				"Failed to remove min_freq request: %d\n", err);
 	}
 
 	if (devfreq->profile->exit)
-- 
2.17.1


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

* Re: [PATCH v2] PM / devfreq: Fix handling dev_pm_qos_remove_request result
  2020-03-12 15:36 ` [PATCH v2] PM / devfreq: Fix handling dev_pm_qos_remove_request result Leonard Crestez
@ 2020-03-16  6:09   ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2020-03-16  6:09 UTC (permalink / raw)
  To: Leonard Crestez, dAN cARPENTER
  Cc: mYUNGjOO hAM, Kyungmin Park, Matthias Kaehlcke, Adam Ford,
	Krzysztof Kozlowski, Rafael J. Wysocki, Viresh Kumar, linux-imx,
	linux-pm, linux-arm-kernel

On 3/13/20 12:36 AM, Leonard Crestez wrote:
> The dev_pm_qos_remove_request function can return 1 if
> "aggregated constraint value has changed" so only negative values should
> be reported as errors.
> 
> Fixes: 27dbc542f651 ("PM / devfreq: Use PM QoS for sysfs min/max_freq")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/devfreq/devfreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Changes since v1:
> * Add fixes and cc: stable, drop empty line in message.
> Link to v1: https://patchwork.kernel.org/patch/11433131/
> 
> I'm not sure this meet that stable kernel standard of "real bug that
> bothers people" because all this fixes is a spurious dev_warn on device
> removal. But Sasha Levin's script seem to collect a lot of low-priority
> fixes anyway.
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 5c481ad1cfc7..6fecd11dafdd 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -703,17 +703,17 @@ static void devfreq_dev_release(struct device *dev)
>  		dev_warn(dev->parent,
>  			"Failed to remove min_freq notifier: %d\n", err);
>  
>  	if (dev_pm_qos_request_active(&devfreq->user_max_freq_req)) {
>  		err = dev_pm_qos_remove_request(&devfreq->user_max_freq_req);
> -		if (err)
> +		if (err < 0)
>  			dev_warn(dev->parent,
>  				"Failed to remove max_freq request: %d\n", err);
>  	}
>  	if (dev_pm_qos_request_active(&devfreq->user_min_freq_req)) {
>  		err = dev_pm_qos_remove_request(&devfreq->user_min_freq_req);
> -		if (err)
> +		if (err < 0)
>  			dev_warn(dev->parent,
>  				"Failed to remove min_freq request: %d\n", err);
>  	}
>  
>  	if (devfreq->profile->exit)
> 

Applied it. Thanks.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

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

end of thread, other threads:[~2020-03-16  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200312153613epcas1p14982cbd7b5e327f8a13a82c95b5bfce4@epcas1p1.samsung.com>
2020-03-12 15:36 ` [PATCH v2] PM / devfreq: Fix handling dev_pm_qos_remove_request result Leonard Crestez
2020-03-16  6:09   ` Chanwoo Choi

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).