From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH 8/8] PCI: Simplify PCI device PM code (rev. 4) Date: Fri, 11 Jul 2008 22:37:30 +0200 Message-ID: <20080711203730.GD6843@elf.ucw.cz> References: <200807012356.26669.rjw@sisk.pl> <200807070330.02849.rjw@sisk.pl> <200807070336.25004.rjw@sisk.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from gprs189-60.eurotel.cz ([160.218.189.60]:32954 "EHLO gprs189-60.eurotel.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756446AbYGKUgy (ORCPT ); Fri, 11 Jul 2008 16:36:54 -0400 Content-Disposition: inline In-Reply-To: <200807070336.25004.rjw@sisk.pl> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: "Rafael J. Wysocki" Cc: Jesse Barnes , ACPI Devel Maling List , Alan Stern , Andi Kleen , pm list , Zhang Rui , Zhao Yakui Hi! > From: Rafael J. Wysocki > > PCI: Simplify PCI device PM code (rev. 4) > > If the offset of PCI device's PM capability in its configuration > space, the mask of states that the device supports PME# from and the > D1 and D2 support bits are cached in the corresponding > struct pci_dev, the PCI device PM code can be simplified quite a bit. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/pci/pci.c | 118 ++++++++++++++++++++--------------------------- > include/linux/pci.h | 8 ++- > include/linux/pci_regs.h | 1 > 3 files changed, 60 insertions(+), 67 deletions(-) > > Index: linux-pci/include/linux/pci.h > =================================================================== > --- linux-pci.orig/include/linux/pci.h > +++ linux-pci/include/linux/pci.h > @@ -177,6 +177,13 @@ struct pci_dev { > pci_power_t current_state; /* Current operating state. In ACPI-speak, > this is D0-D3, D0 being fully functional, > and D3 being off. */ > + int pm_cap; /* PM capability offset in the > + configuration space */ > + unsigned int pme_support:5; /* Bitmask of states from which PME# > + can be generated */ > + unsigned int d1_support:1; /* Low power state D1 is supported */ > + unsigned int d2_support:1; /* Low power state D2 is supported */ > + unsigned int no_d1d2:1; /* Only allow D0 and D3 */ Uh, "D1", "D2", then "no D1D2" ? > } > > - if (pmc & PCI_PM_CAP_PME_MASK) { > + dev->pm_cap = pm; > + > + dev->d1_support = false; > + dev->d2_support = false; I thought d1_support is unsigned int, not bool? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html