Commit f8824cee authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

PM: Allow device drivers to use dpm_wait()

There are some dependencies between devices (in particular, between
EHCI USB controllers and their OHCI/UHCI siblings) which are not
reflected by the structure of the device tree.  With synchronous
suspend and resume these dependencies are taken into accout
automatically, because the devices in question are always registered
in the right order, but to meet these constraints with asynchronous
suspend and resume the drivers of these devices will need to use
dpm_wait() in their suspend/resume routines, so introduce a helper
function allowing them to do that.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent 97df8c12
...@@ -1046,3 +1046,14 @@ void __suspend_report_result(const char *function, void *fn, int ret) ...@@ -1046,3 +1046,14 @@ void __suspend_report_result(const char *function, void *fn, int ret)
printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret); printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
} }
EXPORT_SYMBOL_GPL(__suspend_report_result); EXPORT_SYMBOL_GPL(__suspend_report_result);
/**
* device_pm_wait_for_dev - Wait for suspend/resume of a device to complete.
* @dev: Device to wait for.
* @subordinate: Device that needs to wait for @dev.
*/
void device_pm_wait_for_dev(struct device *subordinate, struct device *dev)
{
dpm_wait(dev, subordinate->power.async_suspend);
}
EXPORT_SYMBOL_GPL(device_pm_wait_for_dev);
...@@ -512,6 +512,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); ...@@ -512,6 +512,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
__suspend_report_result(__func__, fn, ret); \ __suspend_report_result(__func__, fn, ret); \
} while (0) } while (0)
extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
#else /* !CONFIG_PM_SLEEP */ #else /* !CONFIG_PM_SLEEP */
#define device_pm_lock() do {} while (0) #define device_pm_lock() do {} while (0)
...@@ -524,6 +525,7 @@ static inline int dpm_suspend_start(pm_message_t state) ...@@ -524,6 +525,7 @@ static inline int dpm_suspend_start(pm_message_t state)
#define suspend_report_result(fn, ret) do {} while (0) #define suspend_report_result(fn, ret) do {} while (0)
static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
#endif /* !CONFIG_PM_SLEEP */ #endif /* !CONFIG_PM_SLEEP */
/* How to reorder dpm_list after device_move() */ /* How to reorder dpm_list after device_move() */
......
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