]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wilink8-wlan/compat.git/commitdiff
compat: backport pci_wake_from_d3
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 1 Jan 2011 14:23:33 +0000 (06:23 -0800)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 5 Jan 2011 23:20:09 +0000 (15:20 -0800)
This is needed by atl1c.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/compat-2.6.28.c
include/linux/compat-2.6.28.h

index 7a834d2746b9bce879d44e6ab81d916f08895c96..72c9e09dac3b8c322f120b93ae1673d9c0c45d8d 100644 (file)
@@ -439,3 +439,25 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
 }
 EXPORT_SYMBOL(n_tty_ioctl_helper);
 
+/**
+ * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold
+ * @dev: PCI device to prepare
+ * @enable: True to enable wake-up event generation; false to disable
+ *
+ * Many drivers want the device to wake up the system from D3_hot or D3_cold
+ * and this function allows them to set that up cleanly - pci_enable_wake()
+ * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI
+ * ordering constraints.
+ *
+ * This function only returns error code if the device is not capable of
+ * generating PME# from both D3_hot and D3_cold, and the platform is unable to
+ * enable wake-up power for it.
+ */
+int pci_wake_from_d3(struct pci_dev *dev, bool enable)
+{
+       return pci_pme_capable(dev, PCI_D3cold) ?
+                       pci_enable_wake(dev, PCI_D3cold, enable) :
+                       pci_enable_wake(dev, PCI_D3hot, enable);
+}
+EXPORT_SYMBOL(pci_wake_from_d3);
+
index 1de39ad31ac814d01f22a2f7fc81b85baac81f49..b9024d67168b43813439c10cb06e9ab9b57c4325 100644 (file)
@@ -234,6 +234,8 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
 extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
                       unsigned int cmd, unsigned long arg);
 
+int pci_wake_from_d3(struct pci_dev *dev, bool enable);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
 
 #endif /* LINUX_26_28_COMPAT_H */