diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2010-05-26 17:43:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:47 -0400 |
commit | b957e043ee557ca9b6bc451755ecd849b28852a4 (patch) | |
tree | cd5046c854264a71a2de6261a0d2996a098b5c88 | |
parent | e6bde73b07edeb703d4c89c1daabc09c303de11f (diff) |
notifier: change notifier_from_errno(0) to return NOTIFY_OK
This changes notifier_from_errno(0) to be NOTIFY_OK instead of
NOTIFY_STOP_MASK | NOTIFY_OK.
Currently, the notifiers which return encapsulated errno value have to
do something like this:
err = do_something(); // returns -errno
if (err)
return notifier_from_errno(err);
else
return NOTIFY_OK;
This change makes the above code simple:
err = do_something(); // returns -errno
return return notifier_from_errno(err);
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/notifier.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 7c3609622334..540703b555cb 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -164,7 +164,10 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh, | |||
164 | /* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */ | 164 | /* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */ |
165 | static inline int notifier_from_errno(int err) | 165 | static inline int notifier_from_errno(int err) |
166 | { | 166 | { |
167 | return NOTIFY_STOP_MASK | (NOTIFY_OK - err); | 167 | if (err) |
168 | return NOTIFY_STOP_MASK | (NOTIFY_OK - err); | ||
169 | |||
170 | return NOTIFY_OK; | ||
168 | } | 171 | } |
169 | 172 | ||
170 | /* Restore (negative) errno value from notify return value. */ | 173 | /* Restore (negative) errno value from notify return value. */ |