From: Andrew Morton Make it compile with CONFIG_PM=n Cc: David Brownell Signed-off-by: Andrew Morton --- drivers/pci/pci.c | 12 ++++-------- include/linux/pm.h | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff -puN drivers/pci/pci.c~define-platform-wakeup-hook-use-in-pci_enable_wake-fix drivers/pci/pci.c --- a/drivers/pci/pci.c~define-platform-wakeup-hook-use-in-pci_enable_wake-fix +++ a/drivers/pci/pci.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -947,12 +948,7 @@ int pci_enable_wake(struct pci_dev *dev, * userspace updating the /sys/devices.../power/wakeup file. */ - if (platform_enable_wakeup) { - status = platform_enable_wakeup(&dev->dev, enable); - if (status) - return status; - } else - status = -EIO; + status = call_platform_enable_wakeup(&dev->dev, enable); /* find PCI PM capability in list */ pm = pci_find_capability(dev, PCI_CAP_ID_PM); @@ -975,8 +971,8 @@ int pci_enable_wake(struct pci_dev *dev, /* if it can't, revert what the platform hook changed, * always reporting the base "EINVAL, can't PME#" error */ - if (enable && platform_enable_wakeup) - platform_enable_wakeup(&dev->dev, 0); + if (enable) + call_platform_enable_wakeup(&dev->dev, 0); return enable ? -EINVAL : 0; } diff -puN include/linux/pm.h~define-platform-wakeup-hook-use-in-pci_enable_wake-fix include/linux/pm.h --- a/include/linux/pm.h~define-platform-wakeup-hook-use-in-pci_enable_wake-fix +++ a/include/linux/pm.h @@ -277,12 +277,20 @@ extern void __suspend_report_result(cons __suspend_report_result(__FUNCTION__, fn, ret); \ } while (0) -/* platform hook to activate device wakeup capability, if - * that's not already handled by enable_irq_wake() etc - * returns zero on success, else negative errno +/* + * Platform hook to activate device wakeup capability, if that's not already + * handled by enable_irq_wake() etc. + * Returns zero on success, else negative errno */ extern int (*platform_enable_wakeup)(struct device *dev, int is_on); +static inline int call_platform_enable_wakeup(struct device *dev, int is_on) +{ + if (platform_enable_wakeup) + return (*platform_enable_wakeup)(dev, is_on); + return 0; +} + #else /* !CONFIG_PM */ static inline int device_suspend(pm_message_t state) @@ -304,6 +312,11 @@ static inline void dpm_runtime_resume(st #define suspend_report_result(fn, ret) do { } while (0) +static inline int call_platform_enable_wakeup(struct device *dev, int is_on) +{ + return -EIO; +} + #endif /* changes to device_may_wakeup take effect on the next pm state change. _