From patchwork Sun Oct 4 22:48:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 51642 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n94Mp8m2006178 for ; Sun, 4 Oct 2009 22:51:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757821AbZJDWrp (ORCPT ); Sun, 4 Oct 2009 18:47:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757646AbZJDWrp (ORCPT ); Sun, 4 Oct 2009 18:47:45 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:43135 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756166AbZJDWro (ORCPT ); Sun, 4 Oct 2009 18:47:44 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 8D30315CBFC; Mon, 5 Oct 2009 00:47:12 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02982-06; Mon, 5 Oct 2009 00:46:55 +0200 (CEST) Received: from tosh.localnet (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 66C1915CC0F; Mon, 5 Oct 2009 00:46:55 +0200 (CEST) From: "Rafael J. Wysocki" To: Jesse Barnes Subject: [Resend][PATCH] PCI PM: Read device power state from register after updating it Date: Mon, 5 Oct 2009 00:48:40 +0200 User-Agent: KMail/1.12.1 (Linux/2.6.32-rc2-rjw; KDE/4.3.1; x86_64; ; ) Cc: LKML , Linux PCI , pm list , Arjan van de Ven , Andreas Mohr , kevin granade MIME-Version: 1.0 Message-Id: <200910050048.40699.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Index: linux-2.6/drivers/pci/pci.c =================================================================== --- linux-2.6.orig/drivers/pci/pci.c +++ linux-2.6/drivers/pci/pci.c @@ -513,7 +513,11 @@ static int pci_raw_set_power_state(struc else if (state == PCI_D2 || dev->current_state == PCI_D2) udelay(PCI_PM_D2_DELAY); - dev->current_state = state; + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); + dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); + if (dev->current_state != state && printk_ratelimit()) + dev_info(&dev->dev, "Refused to change power state, " + "currently in D%d\n", dev->current_state); /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning