linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / sleep: Drop pm_request_idle() from pm_generic_complete()
@ 2015-09-30  0:44 Rafael J. Wysocki
  2015-10-12 20:15 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2015-09-30  0:44 UTC (permalink / raw)
  To: Linux PM list
  Cc: Linux PCI, Linux Kernel Mailing List, Bjorn Helgaas, Alan Stern

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The pm_request_idle() in pm_generic_complete() is pointless as it is
called with the runtime PM usage counter different from zero (bumped
up by the core during the prepare phase of system suspend) and the
core calls pm_runtime_put() for all devices after executing their
complete callbacks, so drop it.

This allows the PCI PM layer to use pm_generic_complete() too.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

On top of https://patchwork.kernel.org/patch/7291251/ .

---
 drivers/base/power/generic_ops.c |    6 ------
 drivers/pci/pci-driver.c         |    9 ++-------
 2 files changed, 2 insertions(+), 13 deletions(-)

Index: linux-pm/drivers/base/power/generic_ops.c
===================================================================
--- linux-pm.orig/drivers/base/power/generic_ops.c
+++ linux-pm/drivers/base/power/generic_ops.c
@@ -296,11 +296,5 @@ void pm_generic_complete(struct device *
 
 	if (drv && drv->pm && drv->pm->complete)
 		drv->pm->complete(dev);
-
-	/*
-	 * Let runtime PM try to suspend devices that haven't been in use before
-	 * going into the system-wide sleep state we're resuming from.
-	 */
-	pm_request_idle(dev);
 }
 #endif /* CONFIG_PM_SLEEP */
Index: linux-pm/drivers/pci/pci-driver.c
===================================================================
--- linux-pm.orig/drivers/pci/pci-driver.c
+++ linux-pm/drivers/pci/pci-driver.c
@@ -686,13 +686,8 @@ static int pci_pm_prepare(struct device
 
 static void pci_pm_complete(struct device *dev)
 {
-	struct device_driver *drv = dev->driver;
-	struct pci_dev *pci_dev = to_pci_dev(dev);
-
-	pci_dev_complete_resume(pci_dev);
-
-	if (drv && drv->pm && drv->pm->complete)
-		drv->pm->complete(dev);
+	pci_dev_complete_resume(to_pci_dev(dev));
+	pm_generic_complete(dev);
 }
 
 #else /* !CONFIG_PM_SLEEP */


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

* Re: [PATCH] PM / sleep: Drop pm_request_idle() from pm_generic_complete()
  2015-09-30  0:44 [PATCH] PM / sleep: Drop pm_request_idle() from pm_generic_complete() Rafael J. Wysocki
@ 2015-10-12 20:15 ` Rafael J. Wysocki
  2015-10-13  8:01   ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2015-10-12 20:15 UTC (permalink / raw)
  To: Linux PM list
  Cc: Linux PCI, Linux Kernel Mailing List, Bjorn Helgaas, Alan Stern

On Wednesday, September 30, 2015 02:44:29 AM Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The pm_request_idle() in pm_generic_complete() is pointless as it is
> called with the runtime PM usage counter different from zero (bumped
> up by the core during the prepare phase of system suspend) and the
> core calls pm_runtime_put() for all devices after executing their
> complete callbacks, so drop it.
> 
> This allows the PCI PM layer to use pm_generic_complete() too.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> On top of https://patchwork.kernel.org/patch/7291251/ .

Due to the lack of comments for the last several days (which I'm taking as
the lack of objections), I'm tentatively queing this up for v4.4.

Please let me know if there are any problems with that.

Thanks,
Rafael


> ---
>  drivers/base/power/generic_ops.c |    6 ------
>  drivers/pci/pci-driver.c         |    9 ++-------
>  2 files changed, 2 insertions(+), 13 deletions(-)
> 
> Index: linux-pm/drivers/base/power/generic_ops.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/generic_ops.c
> +++ linux-pm/drivers/base/power/generic_ops.c
> @@ -296,11 +296,5 @@ void pm_generic_complete(struct device *
>  
>  	if (drv && drv->pm && drv->pm->complete)
>  		drv->pm->complete(dev);
> -
> -	/*
> -	 * Let runtime PM try to suspend devices that haven't been in use before
> -	 * going into the system-wide sleep state we're resuming from.
> -	 */
> -	pm_request_idle(dev);
>  }
>  #endif /* CONFIG_PM_SLEEP */
> Index: linux-pm/drivers/pci/pci-driver.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/pci-driver.c
> +++ linux-pm/drivers/pci/pci-driver.c
> @@ -686,13 +686,8 @@ static int pci_pm_prepare(struct device
>  
>  static void pci_pm_complete(struct device *dev)
>  {
> -	struct device_driver *drv = dev->driver;
> -	struct pci_dev *pci_dev = to_pci_dev(dev);
> -
> -	pci_dev_complete_resume(pci_dev);
> -
> -	if (drv && drv->pm && drv->pm->complete)
> -		drv->pm->complete(dev);
> +	pci_dev_complete_resume(to_pci_dev(dev));
> +	pm_generic_complete(dev);
>  }
>  
>  #else /* !CONFIG_PM_SLEEP */
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH] PM / sleep: Drop pm_request_idle() from pm_generic_complete()
  2015-10-12 20:15 ` Rafael J. Wysocki
@ 2015-10-13  8:01   ` Ulf Hansson
  0 siblings, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2015-10-13  8:01 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM list, Linux PCI, Linux Kernel Mailing List,
	Bjorn Helgaas, Alan Stern

On 12 October 2015 at 22:15, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Wednesday, September 30, 2015 02:44:29 AM Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> The pm_request_idle() in pm_generic_complete() is pointless as it is
>> called with the runtime PM usage counter different from zero (bumped
>> up by the core during the prepare phase of system suspend) and the
>> core calls pm_runtime_put() for all devices after executing their
>> complete callbacks, so drop it.
>>
>> This allows the PCI PM layer to use pm_generic_complete() too.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> ---
>>
>> On top of https://patchwork.kernel.org/patch/7291251/ .
>
> Due to the lack of comments for the last several days (which I'm taking as
> the lack of objections), I'm tentatively queing this up for v4.4.
>
> Please let me know if there are any problems with that.

Looks good to me, so unless it's too late you may add my reviewed-by tag.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

>
> Thanks,
> Rafael
>
>
>> ---
>>  drivers/base/power/generic_ops.c |    6 ------
>>  drivers/pci/pci-driver.c         |    9 ++-------
>>  2 files changed, 2 insertions(+), 13 deletions(-)
>>
>> Index: linux-pm/drivers/base/power/generic_ops.c
>> ===================================================================
>> --- linux-pm.orig/drivers/base/power/generic_ops.c
>> +++ linux-pm/drivers/base/power/generic_ops.c
>> @@ -296,11 +296,5 @@ void pm_generic_complete(struct device *
>>
>>       if (drv && drv->pm && drv->pm->complete)
>>               drv->pm->complete(dev);
>> -
>> -     /*
>> -      * Let runtime PM try to suspend devices that haven't been in use before
>> -      * going into the system-wide sleep state we're resuming from.
>> -      */
>> -     pm_request_idle(dev);
>>  }
>>  #endif /* CONFIG_PM_SLEEP */
>> Index: linux-pm/drivers/pci/pci-driver.c
>> ===================================================================
>> --- linux-pm.orig/drivers/pci/pci-driver.c
>> +++ linux-pm/drivers/pci/pci-driver.c
>> @@ -686,13 +686,8 @@ static int pci_pm_prepare(struct device
>>
>>  static void pci_pm_complete(struct device *dev)
>>  {
>> -     struct device_driver *drv = dev->driver;
>> -     struct pci_dev *pci_dev = to_pci_dev(dev);
>> -
>> -     pci_dev_complete_resume(pci_dev);
>> -
>> -     if (drv && drv->pm && drv->pm->complete)
>> -             drv->pm->complete(dev);
>> +     pci_dev_complete_resume(to_pci_dev(dev));
>> +     pm_generic_complete(dev);
>>  }
>>
>>  #else /* !CONFIG_PM_SLEEP */
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2015-10-13  8:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30  0:44 [PATCH] PM / sleep: Drop pm_request_idle() from pm_generic_complete() Rafael J. Wysocki
2015-10-12 20:15 ` Rafael J. Wysocki
2015-10-13  8:01   ` Ulf Hansson

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