Commit e9ded0c4 authored by Pavel Machek's avatar Pavel Machek Committed by Greg Kroah-Hartman

[PATCH] PCI: add pci_choose_state()

Could this go to "after 2.6.10 tree", too? It is a helper that
converts system state into PCI state. We really do not want to have
this copied into every driver, because it will need to change when
system state gets type-checked / expanded to struct.


From: Pavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 9c57f57c
...@@ -305,6 +305,30 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -305,6 +305,30 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
return 0; return 0;
} }
/**
* pci_choose_state - Choose the power state of a PCI device
* @dev: PCI device to be suspended
* @state: target sleep state for the whole system
*
* Returns PCI power state suitable for given device and given system
* message.
*/
pci_power_t pci_choose_state(struct pci_dev *dev, u32 state)
{
if (!pci_find_capability(dev, PCI_CAP_ID_PM))
return PCI_D0;
switch (state) {
case 0: return PCI_D0;
case 2: return PCI_D2;
case 3: return PCI_D3hot;
default: BUG();
}
}
EXPORT_SYMBOL(pci_choose_state);
/** /**
* pci_save_state - save the PCI configuration space of a device before suspending * pci_save_state - save the PCI configuration space of a device before suspending
* @dev: - PCI device that we're dealing with * @dev: - PCI device that we're dealing with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment