Re: [PATCH 8/8] PCI: Simplify PCI device PM code (rev. 4)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 2008-07-11 22:45:28, Rafael J. Wysocki wrote:
> On Friday, 11 of July 2008, Pavel Machek wrote:
> > Hi!
> > 
> > > From: Rafael J. Wysocki <rjw@xxxxxxx>
> > > 
> > > 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 <rjw@xxxxxxx>
> > > ---
> > >  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" ?
> 
> Yes.  They are used for different things.

Maybe add one line of explanation?

> > >  	}
> > >  
> > > -	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?
> 
> They are always used as bools, though.

So make them bools? I'm not sure if this is correct C... or were you
trying to save some bits?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux