* [PATCH] mm,mempolicy: mpol_equal() use bool
@ 2011-12-20 22:50 kosaki.motohiro
2011-12-21 0:17 ` David Rientjes
0 siblings, 1 reply; 2+ messages in thread
From: kosaki.motohiro @ 2011-12-20 22:50 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: KOSAKI Motohiro, Andrew Morton, Stephen Wilson, Andrea Arcangeli,
Johannes Weiner
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
mpol_equal() logically return boolean. then it should be used bool.
This change slightly improve readability.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
include/linux/mempolicy.h | 10 +++++-----
mm/mempolicy.c | 14 +++++++-------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 7978eec..7c727a9 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -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);
}
@@ -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)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index adc3954..475f1c7 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1974,28 +1974,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;
}
}
--
1.7.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm,mempolicy: mpol_equal() use bool
2011-12-20 22:50 [PATCH] mm,mempolicy: mpol_equal() use bool kosaki.motohiro
@ 2011-12-21 0:17 ` David Rientjes
0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2011-12-21 0:17 UTC (permalink / raw)
To: kosaki.motohiro
Cc: linux-mm, linux-kernel, KOSAKI Motohiro, Andrew Morton,
Stephen Wilson, Andrea Arcangeli, Johannes Weiner
On Tue, 20 Dec 2011, kosaki.motohiro@gmail.com wrote:
> From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>
> mpol_equal() logically return boolean. then it should be used bool.
> This change slightly improve readability.
>
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
This code predates the introduction of the bool type to the kernel, so
it's a good cleanup, thanks!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-21 0:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 22:50 [PATCH] mm,mempolicy: mpol_equal() use bool kosaki.motohiro
2011-12-21 0:17 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox