diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/main.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 7ae6fe414c38..31b526661ec4 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -51,6 +51,8 @@ static pm_message_t pm_transition; | |||
51 | */ | 51 | */ |
52 | static bool transition_started; | 52 | static bool transition_started; |
53 | 53 | ||
54 | static int async_error; | ||
55 | |||
54 | /** | 56 | /** |
55 | * device_pm_init - Initialize the PM-related part of a device object. | 57 | * device_pm_init - Initialize the PM-related part of a device object. |
56 | * @dev: Device object being initialized. | 58 | * @dev: Device object being initialized. |
@@ -602,6 +604,7 @@ static void dpm_resume(pm_message_t state) | |||
602 | INIT_LIST_HEAD(&list); | 604 | INIT_LIST_HEAD(&list); |
603 | mutex_lock(&dpm_list_mtx); | 605 | mutex_lock(&dpm_list_mtx); |
604 | pm_transition = state; | 606 | pm_transition = state; |
607 | async_error = 0; | ||
605 | 608 | ||
606 | list_for_each_entry(dev, &dpm_list, power.entry) { | 609 | list_for_each_entry(dev, &dpm_list, power.entry) { |
607 | if (dev->power.status < DPM_OFF) | 610 | if (dev->power.status < DPM_OFF) |
@@ -831,8 +834,6 @@ static int legacy_suspend(struct device *dev, pm_message_t state, | |||
831 | return error; | 834 | return error; |
832 | } | 835 | } |
833 | 836 | ||
834 | static int async_error; | ||
835 | |||
836 | /** | 837 | /** |
837 | * device_suspend - Execute "suspend" callbacks for given device. | 838 | * device_suspend - Execute "suspend" callbacks for given device. |
838 | * @dev: Device to handle. | 839 | * @dev: Device to handle. |
@@ -887,6 +888,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
887 | device_unlock(dev); | 888 | device_unlock(dev); |
888 | complete_all(&dev->power.completion); | 889 | complete_all(&dev->power.completion); |
889 | 890 | ||
891 | if (error) | ||
892 | async_error = error; | ||
893 | |||
890 | return error; | 894 | return error; |
891 | } | 895 | } |
892 | 896 | ||
@@ -896,10 +900,8 @@ static void async_suspend(void *data, async_cookie_t cookie) | |||
896 | int error; | 900 | int error; |
897 | 901 | ||
898 | error = __device_suspend(dev, pm_transition, true); | 902 | error = __device_suspend(dev, pm_transition, true); |
899 | if (error) { | 903 | if (error) |
900 | pm_dev_err(dev, pm_transition, " async", error); | 904 | pm_dev_err(dev, pm_transition, " async", error); |
901 | async_error = error; | ||
902 | } | ||
903 | 905 | ||
904 | put_device(dev); | 906 | put_device(dev); |
905 | } | 907 | } |
@@ -1087,8 +1089,9 @@ EXPORT_SYMBOL_GPL(__suspend_report_result); | |||
1087 | * @dev: Device to wait for. | 1089 | * @dev: Device to wait for. |
1088 | * @subordinate: Device that needs to wait for @dev. | 1090 | * @subordinate: Device that needs to wait for @dev. |
1089 | */ | 1091 | */ |
1090 | void device_pm_wait_for_dev(struct device *subordinate, struct device *dev) | 1092 | int device_pm_wait_for_dev(struct device *subordinate, struct device *dev) |
1091 | { | 1093 | { |
1092 | dpm_wait(dev, subordinate->power.async_suspend); | 1094 | dpm_wait(dev, subordinate->power.async_suspend); |
1095 | return async_error; | ||
1093 | } | 1096 | } |
1094 | EXPORT_SYMBOL_GPL(device_pm_wait_for_dev); | 1097 | EXPORT_SYMBOL_GPL(device_pm_wait_for_dev); |