Commit fcfb4dcc9698f932836aa63ba0d82e7dbd300fb3
Committed by
Linus Torvalds
1 parent
0c176d52b0
Exists in
master
and in
20 other branches
mm/mempolicy.c: mpol_equal(): use bool
mpol_equal() logically returns a boolean. Use a bool type to slightly improve readability. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Stephen Wilson <wilsons@start.ca> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 12 additions and 12 deletions Side-by-side Diff
include/linux/mempolicy.h
... | ... | @@ -164,11 +164,11 @@ |
164 | 164 | atomic_inc(&pol->refcnt); |
165 | 165 | } |
166 | 166 | |
167 | -extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b); | |
168 | -static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) | |
167 | +extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b); | |
168 | +static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) | |
169 | 169 | { |
170 | 170 | if (a == b) |
171 | - return 1; | |
171 | + return true; | |
172 | 172 | return __mpol_equal(a, b); |
173 | 173 | } |
174 | 174 | |
175 | 175 | |
... | ... | @@ -257,9 +257,9 @@ |
257 | 257 | |
258 | 258 | struct mempolicy {}; |
259 | 259 | |
260 | -static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) | |
260 | +static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) | |
261 | 261 | { |
262 | - return 1; | |
262 | + return true; | |
263 | 263 | } |
264 | 264 | |
265 | 265 | static inline void mpol_put(struct mempolicy *p) |
mm/mempolicy.c
... | ... | @@ -1983,28 +1983,28 @@ |
1983 | 1983 | } |
1984 | 1984 | |
1985 | 1985 | /* Slow path of a mempolicy comparison */ |
1986 | -int __mpol_equal(struct mempolicy *a, struct mempolicy *b) | |
1986 | +bool __mpol_equal(struct mempolicy *a, struct mempolicy *b) | |
1987 | 1987 | { |
1988 | 1988 | if (!a || !b) |
1989 | - return 0; | |
1989 | + return false; | |
1990 | 1990 | if (a->mode != b->mode) |
1991 | - return 0; | |
1991 | + return false; | |
1992 | 1992 | if (a->flags != b->flags) |
1993 | - return 0; | |
1993 | + return false; | |
1994 | 1994 | if (mpol_store_user_nodemask(a)) |
1995 | 1995 | if (!nodes_equal(a->w.user_nodemask, b->w.user_nodemask)) |
1996 | - return 0; | |
1996 | + return false; | |
1997 | 1997 | |
1998 | 1998 | switch (a->mode) { |
1999 | 1999 | case MPOL_BIND: |
2000 | 2000 | /* Fall through */ |
2001 | 2001 | case MPOL_INTERLEAVE: |
2002 | - return nodes_equal(a->v.nodes, b->v.nodes); | |
2002 | + return !!nodes_equal(a->v.nodes, b->v.nodes); | |
2003 | 2003 | case MPOL_PREFERRED: |
2004 | 2004 | return a->v.preferred_node == b->v.preferred_node; |
2005 | 2005 | default: |
2006 | 2006 | BUG(); |
2007 | - return 0; | |
2007 | + return false; | |
2008 | 2008 | } |
2009 | 2009 | } |
2010 | 2010 |