Skip to content

Commit

Permalink
mm/mempolicy.c: mpol_equal(): use bool
Browse files Browse the repository at this point in the history
mpol_equal() logically returns a boolean.  Use a bool type to slightly
improve readability.

Signed-off-by: KOSAKI Motohiro <[email protected]>
Cc: Stephen Wilson <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kosaki authored and torvalds committed Jan 11, 2012
1 parent 0c176d5 commit fcfb4dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions include/linux/mempolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ static inline void mpol_get(struct mempolicy *pol)
atomic_inc(&pol->refcnt);
}

extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b);
static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b);
static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
{
if (a == b)
return 1;
return true;
return __mpol_equal(a, b);
}

Expand Down Expand Up @@ -257,9 +257,9 @@ static inline int vma_migratable(struct vm_area_struct *vma)

struct mempolicy {};

static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
{
return 1;
return true;
}

static inline void mpol_put(struct mempolicy *p)
Expand Down
14 changes: 7 additions & 7 deletions mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1983,28 +1983,28 @@ struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
}

/* Slow path of a mempolicy comparison */
int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
{
if (!a || !b)
return 0;
return false;
if (a->mode != b->mode)
return 0;
return false;
if (a->flags != b->flags)
return 0;
return false;
if (mpol_store_user_nodemask(a))
if (!nodes_equal(a->w.user_nodemask, b->w.user_nodemask))
return 0;
return false;

switch (a->mode) {
case MPOL_BIND:
/* Fall through */
case MPOL_INTERLEAVE:
return nodes_equal(a->v.nodes, b->v.nodes);
return !!nodes_equal(a->v.nodes, b->v.nodes);
case MPOL_PREFERRED:
return a->v.preferred_node == b->v.preferred_node;
default:
BUG();
return 0;
return false;
}
}

Expand Down

0 comments on commit fcfb4dc

Please sign in to comment.