From: Akinobu Mita Date: Wed, 26 May 2010 21:43:29 +0000 (-0700) Subject: notifier: change notifier_from_errno(0) to return NOTIFY_OK X-Git-Tag: v2.6.35-rc1~148 X-Git-Url: http://bbs.cooldavid.org/git/?a=commitdiff_plain;h=b957e043ee557ca9b6bc451755ecd849b28852a4;p=net-next-2.6.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 7c360962233..540703b555c 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, /* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */ static inline int notifier_from_errno(int err) { - return NOTIFY_STOP_MASK | (NOTIFY_OK - err); + if (err) + return NOTIFY_STOP_MASK | (NOTIFY_OK - err); + + return NOTIFY_OK; } /* Restore (negative) errno value from notify return value. */