Patchwork [6/7] PM / Domains: Check device PM QoS flags in pm_genpd_poweroff()

login
register
mail settings
Submitter Rafael J. Wysocki
Date Oct. 8, 2012, 8:08 a.m.
Message ID <3595636.rclQsqiayj@vostro.rjw.lan>
Download mbox | patch
Permalink /patch/189938/
State Not Applicable
Headers show

Comments

Rafael J. Wysocki - Oct. 8, 2012, 8:08 a.m.
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Make the generic PM domains pm_genpd_poweroff() function take
device PM QoS flags into account when deciding whether or not to
remove power from the domain.

After this change the routine will return -EBUSY without executing
the domain's .power_off() callback if there is at least one PM QoS
flags request for at least one device in the domain and at least of
those request has at least one of the NO_POWER_OFF and REMOTE_WAKEUP
flags set.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Jean Pihet <j-pihet@ti.com>
---
 drivers/base/power/domain.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
mgross - Oct. 10, 2012, 3:35 a.m.
On Mon, Oct 08, 2012 at 10:08:39AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Make the generic PM domains pm_genpd_poweroff() function take
> device PM QoS flags into account when deciding whether or not to
> remove power from the domain.
> 
> After this change the routine will return -EBUSY without executing
> the domain's .power_off() callback if there is at least one PM QoS
> flags request for at least one device in the domain and at least of
> those request has at least one of the NO_POWER_OFF and REMOTE_WAKEUP
> flags set.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reviewed-by: Jean Pihet <j-pihet@ti.com>
> ---
>  drivers/base/power/domain.c |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> Index: linux/drivers/base/power/domain.c
> ===================================================================
> --- linux.orig/drivers/base/power/domain.c
> +++ linux/drivers/base/power/domain.c
> @@ -470,10 +470,19 @@ static int pm_genpd_poweroff(struct gene
>  		return -EBUSY;
>  
>  	not_suspended = 0;
> -	list_for_each_entry(pdd, &genpd->dev_list, list_node)
> +	list_for_each_entry(pdd, &genpd->dev_list, list_node) {
> +		enum pm_qos_flags_status stat;
> +
> +		stat = dev_pm_qos_flags(pdd->dev,
> +					PM_QOS_FLAG_NO_POWER_OFF
> +						| PM_QOS_FLAG_REMOTE_WAKEUP);
> +		if (stat > PM_QOS_FLAGS_NONE)
> +			return -EBUSY;
> +
>  		if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev)
>  		    || pdd->dev->power.irq_safe))
>  			not_suspended++;
> +	}
>  
>  	if (not_suspended > genpd->in_progress)
>  		return -EBUSY;
>
looks ok to me.
Reviewed-by: mark gross <markgross@thegnar.org>

--mrak
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -470,10 +470,19 @@  static int pm_genpd_poweroff(struct gene
 		return -EBUSY;
 
 	not_suspended = 0;
-	list_for_each_entry(pdd, &genpd->dev_list, list_node)
+	list_for_each_entry(pdd, &genpd->dev_list, list_node) {
+		enum pm_qos_flags_status stat;
+
+		stat = dev_pm_qos_flags(pdd->dev,
+					PM_QOS_FLAG_NO_POWER_OFF
+						| PM_QOS_FLAG_REMOTE_WAKEUP);
+		if (stat > PM_QOS_FLAGS_NONE)
+			return -EBUSY;
+
 		if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev)
 		    || pdd->dev->power.irq_safe))
 			not_suspended++;
+	}
 
 	if (not_suspended > genpd->in_progress)
 		return -EBUSY;