linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / QoS: Use the correct variable to check the QoS request type
@ 2017-09-05 21:14 Jan H. Schönherr
  2017-09-19 21:17 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Jan H. Schönherr @ 2017-09-05 21:14 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-pm, Jan H. Schönherr

Use the actual function argument for the validation of the request type,
instead of the type field in a fresh (supposedly zero-initialized)
request structure.

Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
---
 drivers/base/power/qos.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index f850dae..277d43a 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
 	mutex_unlock(&dev_pm_qos_sysfs_mtx);
 }
 
-static bool dev_pm_qos_invalid_request(struct device *dev,
-				       struct dev_pm_qos_request *req)
+static bool dev_pm_qos_invalid_req_type(struct device *dev,
+					enum dev_pm_qos_req_type type)
 {
-	return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE
-			&& !dev->power.set_latency_tolerance);
+	return type == DEV_PM_QOS_LATENCY_TOLERANCE &&
+	       !dev->power.set_latency_tolerance;
 }
 
 static int __dev_pm_qos_add_request(struct device *dev,
@@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev,
 {
 	int ret = 0;
 
-	if (!dev || dev_pm_qos_invalid_request(dev, req))
+	if (!dev || !req || dev_pm_qos_invalid_req_type(dev, type))
 		return -EINVAL;
 
 	if (WARN(dev_pm_qos_request_active(req),
-- 
2.3.1.dirty

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

* Re: [PATCH] PM / QoS: Use the correct variable to check the QoS request type
  2017-09-05 21:14 [PATCH] PM / QoS: Use the correct variable to check the QoS request type Jan H. Schönherr
@ 2017-09-19 21:17 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2017-09-19 21:17 UTC (permalink / raw)
  To: Jan H. Schönherr; +Cc: linux-pm

On Tuesday, September 5, 2017 11:14:29 PM CEST Jan H. Schönherr wrote:
> Use the actual function argument for the validation of the request type,
> instead of the type field in a fresh (supposedly zero-initialized)
> request structure.
> 
> Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
> ---
>  drivers/base/power/qos.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
> index f850dae..277d43a 100644
> --- a/drivers/base/power/qos.c
> +++ b/drivers/base/power/qos.c
> @@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
>  	mutex_unlock(&dev_pm_qos_sysfs_mtx);
>  }
>  
> -static bool dev_pm_qos_invalid_request(struct device *dev,
> -				       struct dev_pm_qos_request *req)
> +static bool dev_pm_qos_invalid_req_type(struct device *dev,
> +					enum dev_pm_qos_req_type type)
>  {
> -	return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE
> -			&& !dev->power.set_latency_tolerance);
> +	return type == DEV_PM_QOS_LATENCY_TOLERANCE &&
> +	       !dev->power.set_latency_tolerance;
>  }
>  
>  static int __dev_pm_qos_add_request(struct device *dev,
> @@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev,
>  {
>  	int ret = 0;
>  
> -	if (!dev || dev_pm_qos_invalid_request(dev, req))
> +	if (!dev || !req || dev_pm_qos_invalid_req_type(dev, type))
>  		return -EINVAL;
>  
>  	if (WARN(dev_pm_qos_request_active(req),
> 

Applied, thanks!

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

end of thread, other threads:[~2017-09-19 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 21:14 [PATCH] PM / QoS: Use the correct variable to check the QoS request type Jan H. Schönherr
2017-09-19 21:17 ` Rafael J. Wysocki

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