Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761758AbZGAAgk (ORCPT ); Tue, 30 Jun 2009 20:36:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759949AbZGAAa0 (ORCPT ); Tue, 30 Jun 2009 20:30:26 -0400 Received: from kroah.org ([198.145.64.141]:34381 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759763AbZGAAaP (ORCPT ); Tue, 30 Jun 2009 20:30:15 -0400 X-Mailbox-Line: From gregkh@mini.kroah.org Tue Jun 30 17:04:00 2009 Message-Id: <20090701000359.976817296@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Tue, 30 Jun 2009 17:00:07 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, "Rafael J. Wysocki" , Jesse Barnes Subject: [patch 23/30] PCI PM: Fix handling of devices without PM support by pci_target_state() References: <20090630235944.868879272@mini.kroah.org> Content-Disposition: inline; filename=pci-pm-fix-handling-of-devices-without-pm-support-by-pci_target_state.patch In-Reply-To: <20090701002817.GA6156@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1818 Lines: 44 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Rafael J. Wysocki commit d2abdf62882d982c58e7a6b09ecdcfcc28075e2e upstream. If a PCI device is not power-manageable either by the platform, or with the help of the native PCI PM interface, pci_target_state() will return either PCI_D3hot, or PCI_POWER_ERROR for it, depending on whether or not the device is configured to wake up the system. Alas, none of these return values is correct, because each of them causes pci_prepare_to_sleep() to return error code, although it should complete successfully in such a case. Fix this problem by making pci_target_state() always return PCI_D0 for devices that cannot be power managed. Signed-off-by: Rafael J. Wysocki Signed-off-by: Jesse Barnes Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1184,15 +1184,14 @@ pci_power_t pci_target_state(struct pci_ default: target_state = state; } + } else if (!dev->pm_cap) { + target_state = PCI_D0; } else if (device_may_wakeup(&dev->dev)) { /* * Find the deepest state from which the device can generate * wake-up events, make it the target state and enable device * to generate PME#. */ - if (!dev->pm_cap) - return PCI_POWER_ERROR; - if (dev->pme_support) { while (target_state && !(dev->pme_support & (1 << target_state))) -- 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/