diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2012-01-10 18:08:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 19:30:45 -0500 |
commit | fcfb4dcc9698f932836aa63ba0d82e7dbd300fb3 (patch) | |
tree | 3a01fc96cc2ba9c339e2848c20a241a9ec9d2423 | |
parent | 0c176d52b0b2619f231b2bbf329b90c028134f58 (diff) |
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>
-rw-r--r-- | include/linux/mempolicy.h | 10 | ||||
-rw-r--r-- | mm/mempolicy.c | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 7978eec1b7d9..7c727a90d70d 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -164,11 +164,11 @@ static inline void mpol_get(struct mempolicy *pol) | |||
164 | atomic_inc(&pol->refcnt); | 164 | atomic_inc(&pol->refcnt); |
165 | } | 165 | } |
166 | 166 | ||
167 | extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b); | 167 | extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b); |
168 | static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) | 168 | static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) |
169 | { | 169 | { |
170 | if (a == b) | 170 | if (a == b) |
171 | return 1; | 171 | return true; |
172 | return __mpol_equal(a, b); | 172 | return __mpol_equal(a, b); |
173 | } | 173 | } |
174 | 174 | ||
@@ -257,9 +257,9 @@ static inline int vma_migratable(struct vm_area_struct *vma) | |||
257 | 257 | ||
258 | struct mempolicy {}; | 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 | static inline void mpol_put(struct mempolicy *p) | 265 | static inline void mpol_put(struct mempolicy *p) |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index c3fdbcb17658..e3d58f088466 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1983,28 +1983,28 @@ struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol, | |||
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | /* Slow path of a mempolicy comparison */ | 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 | if (!a || !b) | 1988 | if (!a || !b) |
1989 | return 0; | 1989 | return false; |
1990 | if (a->mode != b->mode) | 1990 | if (a->mode != b->mode) |
1991 | return 0; | 1991 | return false; |
1992 | if (a->flags != b->flags) | 1992 | if (a->flags != b->flags) |
1993 | return 0; | 1993 | return false; |
1994 | if (mpol_store_user_nodemask(a)) | 1994 | if (mpol_store_user_nodemask(a)) |
1995 | if (!nodes_equal(a->w.user_nodemask, b->w.user_nodemask)) | 1995 | if (!nodes_equal(a->w.user_nodemask, b->w.user_nodemask)) |
1996 | return 0; | 1996 | return false; |
1997 | 1997 | ||
1998 | switch (a->mode) { | 1998 | switch (a->mode) { |
1999 | case MPOL_BIND: | 1999 | case MPOL_BIND: |
2000 | /* Fall through */ | 2000 | /* Fall through */ |
2001 | case MPOL_INTERLEAVE: | 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 | case MPOL_PREFERRED: | 2003 | case MPOL_PREFERRED: |
2004 | return a->v.preferred_node == b->v.preferred_node; | 2004 | return a->v.preferred_node == b->v.preferred_node; |
2005 | default: | 2005 | default: |
2006 | BUG(); | 2006 | BUG(); |
2007 | return 0; | 2007 | return false; |
2008 | } | 2008 | } |
2009 | } | 2009 | } |
2010 | 2010 | ||