linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: Ensure we re-enable devices on resume
@ 2010-04-22 13:30 Matthew Garrett
  2010-04-22 18:14 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Matthew Garrett @ 2010-04-22 13:30 UTC (permalink / raw)
  To: jbarnes; +Cc: linux-pci, linux-acpi, achiang, rjw, Matthew Garrett

If the firmware puts a device back into D0 state at resume time, we'll
update its state in resume_noirq and thus skip the platform resume code.
Calling that code twice should be safe and we ought to avoid getting to
that point anyway, so remove the check and also allow the platform pci
code to be called for D0.

Fixes USB not being powered after resume on recent Lenovo machines.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
 drivers/pci/pci.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5ea587e..3749912 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -679,7 +679,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
  */
 int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
 {
-	return state > PCI_D0 ?
+	return state >= PCI_D0 ?
 			pci_platform_power_transition(dev, state) : -EINVAL;
 }
 EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
@@ -716,10 +716,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 		 */
 		return 0;
 
-	/* Check if we're already there */
-	if (dev->current_state == state)
-		return 0;
-
 	__pci_start_power_transition(dev, state);
 
 	/* This device is quirked not to be put into D3, so
-- 
1.7.0.1


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

* Re: [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-22 13:30 [PATCH] pci: Ensure we re-enable devices on resume Matthew Garrett
@ 2010-04-22 18:14 ` Rafael J. Wysocki
  2010-04-22 19:43 ` Alex Chiang
  2010-04-22 23:17 ` Jesse Barnes
  2 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2010-04-22 18:14 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: jbarnes, linux-pci, linux-acpi, achiang

On Thursday 22 April 2010, Matthew Garrett wrote:
> If the firmware puts a device back into D0 state at resume time, we'll
> update its state in resume_noirq and thus skip the platform resume code.
> Calling that code twice should be safe and we ought to avoid getting to
> that point anyway, so remove the check and also allow the platform pci
> code to be called for D0.
> 
> Fixes USB not being powered after resume on recent Lenovo machines.

OK ...

> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  drivers/pci/pci.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 5ea587e..3749912 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -679,7 +679,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
>   */
>  int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
>  {
> -	return state > PCI_D0 ?
> +	return state >= PCI_D0 ?
>  			pci_platform_power_transition(dev, state) : -EINVAL;
>  }
>  EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
> @@ -716,10 +716,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
>  		 */
>  		return 0;
>  
> -	/* Check if we're already there */
> -	if (dev->current_state == state)
> -		return 0;
> -

If my memory serves me right, this check is actually there for a reason,
although I don't remember _what_ exactly the reason is right now.  Sigh.

[/me puts a note for himself to _always_ add specific comments into the code
 in such cases.]

>  	__pci_start_power_transition(dev, state);
>  
>  	/* This device is quirked not to be put into D3, so
> 

Well, I'd say let's try that.  If it breaks things, we'll know relatively quickly. ;-)

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>

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

* Re: [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-22 13:30 [PATCH] pci: Ensure we re-enable devices on resume Matthew Garrett
  2010-04-22 18:14 ` Rafael J. Wysocki
@ 2010-04-22 19:43 ` Alex Chiang
  2010-04-22 23:17 ` Jesse Barnes
  2 siblings, 0 replies; 8+ messages in thread
From: Alex Chiang @ 2010-04-22 19:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: jbarnes, linux-pci, linux-acpi, rjw, jerone.young

Looks good to me. Thanks for doing this, Matthew.

Acked-by: Alex Chiang <achiang@canonical.com>

/ac

* Matthew Garrett <mjg@redhat.com>:
> If the firmware puts a device back into D0 state at resume time, we'll
> update its state in resume_noirq and thus skip the platform resume code.
> Calling that code twice should be safe and we ought to avoid getting to
> that point anyway, so remove the check and also allow the platform pci
> code to be called for D0.
> 
> Fixes USB not being powered after resume on recent Lenovo machines.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  drivers/pci/pci.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 5ea587e..3749912 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -679,7 +679,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
>   */
>  int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
>  {
> -	return state > PCI_D0 ?
> +	return state >= PCI_D0 ?
>  			pci_platform_power_transition(dev, state) : -EINVAL;
>  }
>  EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
> @@ -716,10 +716,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
>  		 */
>  		return 0;
>  
> -	/* Check if we're already there */
> -	if (dev->current_state == state)
> -		return 0;
> -
>  	__pci_start_power_transition(dev, state);
>  
>  	/* This device is quirked not to be put into D3, so
> -- 
> 1.7.0.1
> 

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

* Re: [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-22 13:30 [PATCH] pci: Ensure we re-enable devices on resume Matthew Garrett
  2010-04-22 18:14 ` Rafael J. Wysocki
  2010-04-22 19:43 ` Alex Chiang
@ 2010-04-22 23:17 ` Jesse Barnes
  2010-04-22 23:46   ` Alex Chiang
  2 siblings, 1 reply; 8+ messages in thread
From: Jesse Barnes @ 2010-04-22 23:17 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-pci, linux-acpi, achiang, rjw

On Thu, 22 Apr 2010 09:30:51 -0400
Matthew Garrett <mjg@redhat.com> wrote:

> If the firmware puts a device back into D0 state at resume time, we'll
> update its state in resume_noirq and thus skip the platform resume code.
> Calling that code twice should be safe and we ought to avoid getting to
> that point anyway, so remove the check and also allow the platform pci
> code to be called for D0.
> 
> Fixes USB not being powered after resume on recent Lenovo machines.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---

Applied to for-linus, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

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

* Re: [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-22 23:17 ` Jesse Barnes
@ 2010-04-22 23:46   ` Alex Chiang
  2010-04-23  0:08     ` [stable] " Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Chiang @ 2010-04-22 23:46 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Matthew Garrett, linux-pci, linux-acpi, rjw, stable

* Jesse Barnes <jbarnes@virtuousgeek.org>:
> On Thu, 22 Apr 2010 09:30:51 -0400
> Matthew Garrett <mjg@redhat.com> wrote:
> 
> > If the firmware puts a device back into D0 state at resume time, we'll
> > update its state in resume_noirq and thus skip the platform resume code.
> > Calling that code twice should be safe and we ought to avoid getting to
> > that point anyway, so remove the check and also allow the platform pci
> > code to be called for D0.
> > 
> > Fixes USB not being powered after resume on recent Lenovo machines.
> > 
> > Signed-off-by: Matthew Garrett <mjg@redhat.com>
> 
> Applied to for-linus, thanks.

Thanks Jesse. 

Stable, can you please pick this up too?

The original commit that introduced the thinko was 4a865905.

achiang@aspen:~/kernels/linux-2.6$ git describe --contains 4a865905
v2.6.30-rc1~609^2~4

which looks like it was introduced in 2.6.30, but I'd be happy with
just hitting v2.6.32, since this is what just about every distro
has settled on these days.

Thanks,
/ac

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

* Re: [stable] [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-22 23:46   ` Alex Chiang
@ 2010-04-23  0:08     ` Greg KH
  2010-04-25  4:21       ` Alex Chiang
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2010-04-23  0:08 UTC (permalink / raw)
  To: Alex Chiang, Jesse Barnes, Matthew Garrett, linux-pci, linux-acpi,
	rjw, sta

On Thu, Apr 22, 2010 at 05:46:53PM -0600, Alex Chiang wrote:
> * Jesse Barnes <jbarnes@virtuousgeek.org>:
> > On Thu, 22 Apr 2010 09:30:51 -0400
> > Matthew Garrett <mjg@redhat.com> wrote:
> > 
> > > If the firmware puts a device back into D0 state at resume time, we'll
> > > update its state in resume_noirq and thus skip the platform resume code.
> > > Calling that code twice should be safe and we ought to avoid getting to
> > > that point anyway, so remove the check and also allow the platform pci
> > > code to be called for D0.
> > > 
> > > Fixes USB not being powered after resume on recent Lenovo machines.
> > > 
> > > Signed-off-by: Matthew Garrett <mjg@redhat.com>
> > 
> > Applied to for-linus, thanks.
> 
> Thanks Jesse. 
> 
> Stable, can you please pick this up too?

When it goes into Linus's tree, yes.  Care to let me know what the git
commit id of it is when that happens?

thanks,

greg k-h

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

* Re: [stable] [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-23  0:08     ` [stable] " Greg KH
@ 2010-04-25  4:21       ` Alex Chiang
  2010-05-07 20:43         ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Chiang @ 2010-04-25  4:21 UTC (permalink / raw)
  To: Greg KH; +Cc: Jesse Barnes, Matthew Garrett, linux-pci, linux-acpi, rjw, stable

* Greg KH <greg@kroah.com>:
> On Thu, Apr 22, 2010 at 05:46:53PM -0600, Alex Chiang wrote:
> > * Jesse Barnes <jbarnes@virtuousgeek.org>:
> > > Matthew Garrett <mjg@redhat.com> wrote:
> > > 
> > > > If the firmware puts a device back into D0 state at
> > > > resume time, we'll update its state in resume_noirq and
> > > > thus skip the platform resume code. Calling that code
> > > > twice should be safe and we ought to avoid getting to
> > > > that point anyway, so remove the check and also allow the
> > > > platform pci code to be called for D0.
> > > > 
> > > > Fixes USB not being powered after resume on recent Lenovo
> > > > machines.
> > > > 
> > > 
> > > Applied to for-linus, thanks.
> > 
> > Stable, can you please pick this up too?
> 
> When it goes into Linus's tree, yes.  Care to let me know what
> the git commit id of it is when that happens?

commit cc2893b6af5265baa1d68b17b136cffca9e40cfa

Thanks!
/ac

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

* Re: [stable] [PATCH] pci: Ensure we re-enable devices on resume
  2010-04-25  4:21       ` Alex Chiang
@ 2010-05-07 20:43         ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2010-05-07 20:43 UTC (permalink / raw)
  To: Alex Chiang, Jesse Barnes, Matthew Garrett, linux-pci, linux-acpi,
	rjw, sta

On Sat, Apr 24, 2010 at 10:21:49PM -0600, Alex Chiang wrote:
> * Greg KH <greg@kroah.com>:
> > On Thu, Apr 22, 2010 at 05:46:53PM -0600, Alex Chiang wrote:
> > > * Jesse Barnes <jbarnes@virtuousgeek.org>:
> > > > Matthew Garrett <mjg@redhat.com> wrote:
> > > > 
> > > > > If the firmware puts a device back into D0 state at
> > > > > resume time, we'll update its state in resume_noirq and
> > > > > thus skip the platform resume code. Calling that code
> > > > > twice should be safe and we ought to avoid getting to
> > > > > that point anyway, so remove the check and also allow the
> > > > > platform pci code to be called for D0.
> > > > > 
> > > > > Fixes USB not being powered after resume on recent Lenovo
> > > > > machines.
> > > > > 
> > > > 
> > > > Applied to for-linus, thanks.
> > > 
> > > Stable, can you please pick this up too?
> > 
> > When it goes into Linus's tree, yes.  Care to let me know what
> > the git commit id of it is when that happens?
> 
> commit cc2893b6af5265baa1d68b17b136cffca9e40cfa

Now queued up.

thanks,

greg k-h

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

end of thread, other threads:[~2010-05-07 21:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 13:30 [PATCH] pci: Ensure we re-enable devices on resume Matthew Garrett
2010-04-22 18:14 ` Rafael J. Wysocki
2010-04-22 19:43 ` Alex Chiang
2010-04-22 23:17 ` Jesse Barnes
2010-04-22 23:46   ` Alex Chiang
2010-04-23  0:08     ` [stable] " Greg KH
2010-04-25  4:21       ` Alex Chiang
2010-05-07 20:43         ` Greg KH

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