Re: [PATCH] PCI patches for 2.6.10

From: Greg KH
Date: Mon Jan 10 2005 - 23:26:57 EST


ChangeSet 1.1938.447.11, 2004/12/17 14:03:28-08:00, pavel@xxxxxx

[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@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/pci/pci.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+)


diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c 2005-01-10 09:01:09 -08:00
+++ b/drivers/pci/pci.c 2005-01-10 09:01:09 -08:00
@@ -306,6 +306,30 @@
}

/**
+ * 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
* @dev: - PCI device that we're dealing with
* @buffer: - buffer to hold config space context

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/