Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PM

The pm_generic_runtime_suspend|resume functions were implemented within
CONFIG_PM_RUNTIME.

As we also may use runtime PM callbacks during system suspend, to put
devices into low power state, we need to move the implementation of
pm_generic_runtime_suspend|resume to CONFIG_PM.

This change gives a power domain provision to invoke a platform
driver's runtime PM callback from a power domain's system PM callback.
This were earlier prevented by the platform bus, since it uses the
pm_generic_runtime_suspend|resume functions as runtime PM callbacks.

Cc: Kevin Hilman <khilman@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Ulf Hansson and committed by
Rafael J. Wysocki
717e5d45 d9fb563d

+10 -6
+2 -2
drivers/base/power/generic_ops.c
··· 10 10 #include <linux/pm_runtime.h> 11 11 #include <linux/export.h> 12 12 13 - #ifdef CONFIG_PM_RUNTIME 13 + #ifdef CONFIG_PM 14 14 /** 15 15 * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems. 16 16 * @dev: Device to suspend. ··· 48 48 return ret; 49 49 } 50 50 EXPORT_SYMBOL_GPL(pm_generic_runtime_resume); 51 - #endif /* CONFIG_PM_RUNTIME */ 51 + #endif /* CONFIG_PM */ 52 52 53 53 #ifdef CONFIG_PM_SLEEP 54 54 /**
+8 -4
include/linux/pm_runtime.h
··· 23 23 usage_count */ 24 24 #define RPM_AUTO 0x08 /* Use autosuspend_delay */ 25 25 26 + #ifdef CONFIG_PM 27 + extern int pm_generic_runtime_suspend(struct device *dev); 28 + extern int pm_generic_runtime_resume(struct device *dev); 29 + #else 30 + static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 31 + static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 32 + #endif 33 + 26 34 #ifdef CONFIG_PM_RUNTIME 27 35 28 36 extern struct workqueue_struct *pm_wq; ··· 45 37 extern void __pm_runtime_disable(struct device *dev, bool check_resume); 46 38 extern void pm_runtime_allow(struct device *dev); 47 39 extern void pm_runtime_forbid(struct device *dev); 48 - extern int pm_generic_runtime_suspend(struct device *dev); 49 - extern int pm_generic_runtime_resume(struct device *dev); 50 40 extern void pm_runtime_no_callbacks(struct device *dev); 51 41 extern void pm_runtime_irq_safe(struct device *dev); 52 42 extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); ··· 148 142 static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 149 143 static inline bool pm_runtime_enabled(struct device *dev) { return false; } 150 144 151 - static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 152 - static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 153 145 static inline void pm_runtime_no_callbacks(struct device *dev) {} 154 146 static inline void pm_runtime_irq_safe(struct device *dev) {} 155 147