Commit f0c077a8b7f9dce590c760a7b2f3c417dffa52d1
Committed by
Rafael J. Wysocki
1 parent
1d8047a6f7
Exists in
master
and in
4 other branches
PM: Improve error code of pm_notifier_call_chain()
This enables pm_notifier_call_chain() to get the actual error code in the callback rather than always assume -EINVAL by converting all PM notifier calls to return encapsulate error code with notifier_from_errno(). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Showing 4 changed files with 10 additions and 9 deletions Side-by-side Diff
drivers/char/apm-emulation.c
drivers/s390/char/vmwatchdog.c
... | ... | @@ -258,13 +258,13 @@ |
258 | 258 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { |
259 | 259 | pr_err("The system cannot be suspended while the watchdog" |
260 | 260 | " is in use\n"); |
261 | - return NOTIFY_BAD; | |
261 | + return notifier_from_errno(-EBUSY); | |
262 | 262 | } |
263 | 263 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { |
264 | 264 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); |
265 | 265 | pr_err("The system cannot be suspended while the watchdog" |
266 | 266 | " is running\n"); |
267 | - return NOTIFY_BAD; | |
267 | + return notifier_from_errno(-EBUSY); | |
268 | 268 | } |
269 | 269 | return NOTIFY_DONE; |
270 | 270 | } |
drivers/s390/cio/css.c
... | ... | @@ -814,8 +814,8 @@ |
814 | 814 | mutex_unlock(&css->mutex); |
815 | 815 | continue; |
816 | 816 | } |
817 | - if (__chsc_do_secm(css, 0)) | |
818 | - ret = NOTIFY_BAD; | |
817 | + ret = __chsc_do_secm(css, 0); | |
818 | + ret = notifier_from_errno(ret); | |
819 | 819 | mutex_unlock(&css->mutex); |
820 | 820 | } |
821 | 821 | break; |
... | ... | @@ -831,8 +831,8 @@ |
831 | 831 | mutex_unlock(&css->mutex); |
832 | 832 | continue; |
833 | 833 | } |
834 | - if (__chsc_do_secm(css, 1)) | |
835 | - ret = NOTIFY_BAD; | |
834 | + ret = __chsc_do_secm(css, 1); | |
835 | + ret = notifier_from_errno(ret); | |
836 | 836 | mutex_unlock(&css->mutex); |
837 | 837 | } |
838 | 838 | /* search for subchannels, which appeared during hibernation */ |
kernel/power/main.c
... | ... | @@ -37,8 +37,9 @@ |
37 | 37 | |
38 | 38 | int pm_notifier_call_chain(unsigned long val) |
39 | 39 | { |
40 | - return (blocking_notifier_call_chain(&pm_chain_head, val, NULL) | |
41 | - == NOTIFY_BAD) ? -EINVAL : 0; | |
40 | + int ret = blocking_notifier_call_chain(&pm_chain_head, val, NULL); | |
41 | + | |
42 | + return notifier_to_errno(ret); | |
42 | 43 | } |
43 | 44 | |
44 | 45 | /* If set, devices may be suspended and resumed asynchronously. */ |