On Mon 2008-06-23 19:45:32, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rjw@xxxxxxx> > > PCI: Rework pci_set_power_state function (rev. 3) > > Rework pci_set_power_state() so that the platform callback is > invoked before the native mechanism, if necessary. Also, make > the function check if the device is power manageable by the > platform before invoking the platform callback. > > This may matter if the device dependent on additional power > resources controlled by the platform is being put into D0, in which > case those power resources must be turned on before we attempt to > handle the device itself. > > Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx> Looks mostly ok to me... > +/** > + * pci_set_power_state - Set the power state of a PCI device > + * @dev: PCI device to handle. > + * @state: PCI power state (D0, D1, D2, D3hot) to put the device into. > + * > + * Transition a device to a new power state, using the platform formware and/or > + * the device's PCI PM registers. > + * > + * RETURN VALUE: > + * -EINVAL if the requested state is invalid. > + * -EIO if device does not support PCI PM or its PM capabilities register has a > + * wrong version, or device doesn't support the requested state. > + * 0 if device already is in the requested state. > + * 0 if device's power state has been successfully changed. > + */ > +int pci_set_power_state(struct pci_dev *dev, pci_power_t state) > +{ > + int pm, error; > + > + /* bound the state we're entering */ > + if (state > PCI_D3hot) > + state = PCI_D3hot; > + else if (state < PCI_D0) > + state = PCI_D0; Should it return einval in those two cases? Docs above says it does... 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