* [PATCH 1/2] rcu: use bool value directly
@ 2017-03-25 19:46 Nicholas Mc Guire
2017-03-25 19:46 ` [PATCH 2/2] rcu: tree_plugin.h: use true/false in assignment to bool Nicholas Mc Guire
2017-03-25 23:36 ` [PATCH 1/2] rcu: use bool value directly Paul E. McKenney
0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2017-03-25 19:46 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
linux-kernel, Nicholas Mc Guire
beenonline is declared bool so no need for an explicit comparison
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
Found by coccinelle: boolinit.cocci complained about
./kernel/rcu/tree.c:2986:14-29: WARNING: Comparison of bool to 0/1
If the comparison was intended for readability I guess it should be
against "false" not 0 - but it seems common to just use bool values
directly.
Patch was compile-tested with: x86_64_defconfig (implies CONFIG_TREE_RCU=y)
(with some sparse warnings)
Patch is against 4.11-rc3 (localversion-next is next-20170324)
kernel/rcu/tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 712ddce..ab9fbec 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2983,7 +2983,7 @@ __rcu_process_callbacks(struct rcu_state *rsp)
bool needwake;
struct rcu_data *rdp = raw_cpu_ptr(rsp->rda);
- WARN_ON_ONCE(rdp->beenonline == 0);
+ WARN_ON_ONCE(!rdp->beenonline);
/* Update RCU state based on any recent quiescent states. */
rcu_check_quiescent_state(rsp, rdp);
--
2.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] rcu: tree_plugin.h: use true/false in assignment to bool
2017-03-25 19:46 [PATCH 1/2] rcu: use bool value directly Nicholas Mc Guire
@ 2017-03-25 19:46 ` Nicholas Mc Guire
2017-03-25 23:36 ` [PATCH 1/2] rcu: use bool value directly Paul E. McKenney
1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2017-03-25 19:46 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
linux-kernel, Nicholas Mc Guire
bool variables in this code are using true/false for assignments
fix this up for consistency/readability.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
Found by coccinelle: boolinit.cocci complained about
./kernel/rcu/tree_plugin.h:1712:1-14: WARNING: Assignment of bool to 0/1
Patch was compile-tested with: x86_64_defconfig (implies CONFIG_TREE_RCU=y)
Patch is against 4.11-rc3 (localversion-next is next-20170324)
kernel/rcu/tree_plugin.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index db0a034..6d8f7f8 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1709,7 +1709,7 @@ __setup("rcu_nocbs=", rcu_nocb_setup);
static int __init parse_rcu_nocb_poll(char *arg)
{
- rcu_nocb_poll = 1;
+ rcu_nocb_poll = true;
return 0;
}
early_param("rcu_nocb_poll", parse_rcu_nocb_poll);
--
2.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] rcu: use bool value directly
2017-03-25 19:46 [PATCH 1/2] rcu: use bool value directly Nicholas Mc Guire
2017-03-25 19:46 ` [PATCH 2/2] rcu: tree_plugin.h: use true/false in assignment to bool Nicholas Mc Guire
@ 2017-03-25 23:36 ` Paul E. McKenney
1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2017-03-25 23:36 UTC (permalink / raw)
To: Nicholas Mc Guire
Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
linux-kernel
On Sat, Mar 25, 2017 at 08:46:01PM +0100, Nicholas Mc Guire wrote:
> beenonline is declared bool so no need for an explicit comparison
>
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Queued both for review and testing, thank you!
Thanx, Paul
> ---
>
> Found by coccinelle: boolinit.cocci complained about
> ./kernel/rcu/tree.c:2986:14-29: WARNING: Comparison of bool to 0/1
>
> If the comparison was intended for readability I guess it should be
> against "false" not 0 - but it seems common to just use bool values
> directly.
>
> Patch was compile-tested with: x86_64_defconfig (implies CONFIG_TREE_RCU=y)
> (with some sparse warnings)
>
> Patch is against 4.11-rc3 (localversion-next is next-20170324)
>
> kernel/rcu/tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 712ddce..ab9fbec 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2983,7 +2983,7 @@ __rcu_process_callbacks(struct rcu_state *rsp)
> bool needwake;
> struct rcu_data *rdp = raw_cpu_ptr(rsp->rda);
>
> - WARN_ON_ONCE(rdp->beenonline == 0);
> + WARN_ON_ONCE(!rdp->beenonline);
>
> /* Update RCU state based on any recent quiescent states. */
> rcu_check_quiescent_state(rsp, rdp);
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-26 1:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-25 19:46 [PATCH 1/2] rcu: use bool value directly Nicholas Mc Guire
2017-03-25 19:46 ` [PATCH 2/2] rcu: tree_plugin.h: use true/false in assignment to bool Nicholas Mc Guire
2017-03-25 23:36 ` [PATCH 1/2] rcu: use bool value directly Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome