From patchwork Tue Apr 27 03:27:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Chiang X-Patchwork-Id: 51030 X-Patchwork-Delegate: stefan.bader@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 304BEB7D57 for ; Tue, 27 Apr 2010 13:28:02 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O6bSj-0005Xz-04; Tue, 27 Apr 2010 04:27:53 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O6bSg-0005XK-SL for kernel-team@lists.ubuntu.com; Tue, 27 Apr 2010 04:27:50 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1O6bSg-0004Fk-R8 for ; Tue, 27 Apr 2010 04:27:50 +0100 Received: from 97-122-123-117.hlrn.qwest.net ([97.122.123.117] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1O6bSg-0004la-Eu for kernel-team@lists.ubuntu.com; Tue, 27 Apr 2010 04:27:50 +0100 Date: Mon, 26 Apr 2010 21:27:46 -0600 From: Alex Chiang To: kernel-team@lists.ubuntu.com Subject: [PATCH][Karmic] SRU: pci: Ensure we re-enable devices on resume Message-ID: <20100427032746.GB8140@canonical.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/566149 SRU justification: The original patch which added the check in pci_set_power_state was a minor thinko, and prevented platform resume code from running. This patch removes the incorrect check, allowing platform resume code to run, thus re-enabling devices such as USB ports. Backport of upstream commit: commit cc2893b6af5265baa1d68b17b136cffca9e40cfa Author: Matthew Garrett Date: Thu Apr 22 09:30:51 2010 -0400 PCI: Ensure we re-enable devices on resume 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. Acked-by: Alex Chiang Acked-by: Rafael J. Wysocki Signed-off-by: Matthew Garrett Signed-off-by: Jesse Barnes Signed-off-by: Alex Chiang Acked-by: Tim Gardner Acked-by: Stefan Bader diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e5f3f1c..579dcf5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -591,7 +591,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); @@ -628,10 +628,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