aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/power/runtime_pm.txt1
-rw-r--r--drivers/base/power/runtime.c15
2 files changed, 13 insertions, 3 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index 4ce5450ab6e..62f37bc3866 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -484,6 +484,7 @@ pm_runtime_resume()
484pm_runtime_get_sync() 484pm_runtime_get_sync()
485pm_runtime_put_sync() 485pm_runtime_put_sync()
486pm_runtime_put_sync_suspend() 486pm_runtime_put_sync_suspend()
487pm_runtime_put_sync_autosuspend()
487 488
4885. Runtime PM Initialization, Device Probing and Removal 4895. Runtime PM Initialization, Device Probing and Removal
489 490
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index acb3f83b807..04e18abb50b 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -732,13 +732,16 @@ EXPORT_SYMBOL_GPL(pm_schedule_suspend);
732 * return immediately if it is larger than zero. Then carry out an idle 732 * return immediately if it is larger than zero. Then carry out an idle
733 * notification, either synchronous or asynchronous. 733 * notification, either synchronous or asynchronous.
734 * 734 *
735 * This routine may be called in atomic context if the RPM_ASYNC flag is set. 735 * This routine may be called in atomic context if the RPM_ASYNC flag is set,
736 * or if pm_runtime_irq_safe() has been called.
736 */ 737 */
737int __pm_runtime_idle(struct device *dev, int rpmflags) 738int __pm_runtime_idle(struct device *dev, int rpmflags)
738{ 739{
739 unsigned long flags; 740 unsigned long flags;
740 int retval; 741 int retval;
741 742
743 might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe);
744
742 if (rpmflags & RPM_GET_PUT) { 745 if (rpmflags & RPM_GET_PUT) {
743 if (!atomic_dec_and_test(&dev->power.usage_count)) 746 if (!atomic_dec_and_test(&dev->power.usage_count))
744 return 0; 747 return 0;
@@ -761,13 +764,16 @@ EXPORT_SYMBOL_GPL(__pm_runtime_idle);
761 * return immediately if it is larger than zero. Then carry out a suspend, 764 * return immediately if it is larger than zero. Then carry out a suspend,
762 * either synchronous or asynchronous. 765 * either synchronous or asynchronous.
763 * 766 *
764 * This routine may be called in atomic context if the RPM_ASYNC flag is set. 767 * This routine may be called in atomic context if the RPM_ASYNC flag is set,
768 * or if pm_runtime_irq_safe() has been called.
765 */ 769 */
766int __pm_runtime_suspend(struct device *dev, int rpmflags) 770int __pm_runtime_suspend(struct device *dev, int rpmflags)
767{ 771{
768 unsigned long flags; 772 unsigned long flags;
769 int retval; 773 int retval;
770 774
775 might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe);
776
771 if (rpmflags & RPM_GET_PUT) { 777 if (rpmflags & RPM_GET_PUT) {
772 if (!atomic_dec_and_test(&dev->power.usage_count)) 778 if (!atomic_dec_and_test(&dev->power.usage_count))
773 return 0; 779 return 0;
@@ -789,13 +795,16 @@ EXPORT_SYMBOL_GPL(__pm_runtime_suspend);
789 * If the RPM_GET_PUT flag is set, increment the device's usage count. Then 795 * If the RPM_GET_PUT flag is set, increment the device's usage count. Then
790 * carry out a resume, either synchronous or asynchronous. 796 * carry out a resume, either synchronous or asynchronous.
791 * 797 *
792 * This routine may be called in atomic context if the RPM_ASYNC flag is set. 798 * This routine may be called in atomic context if the RPM_ASYNC flag is set,
799 * or if pm_runtime_irq_safe() has been called.
793 */ 800 */
794int __pm_runtime_resume(struct device *dev, int rpmflags) 801int __pm_runtime_resume(struct device *dev, int rpmflags)
795{ 802{
796 unsigned long flags; 803 unsigned long flags;
797 int retval; 804 int retval;
798 805
806 might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe);
807
799 if (rpmflags & RPM_GET_PUT) 808 if (rpmflags & RPM_GET_PUT)
800 atomic_inc(&dev->power.usage_count); 809 atomic_inc(&dev->power.usage_count);
801 810