Re: [PATCH tip/core/rcu 07/17] key: Remove extraneous parenthesesfrom rcu_assign_keypointer()

From: Paul E. McKenney
Date: Mon Jun 25 2012 - 00:02:55 EST


On Fri, Jun 22, 2012 at 10:59:32PM -0700, Paul E. McKenney wrote:
> On Fri, Jun 22, 2012 at 05:04:36PM +0100, David Howells wrote:
> > Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > > This commit removes the extraneous parentheses from rcu_assign_keypointer()
> > > so that rcu_assign_pointer() can be wrapped in do-while.
> >
> > Should it be wrapped in a do-while itself then?
> >
> > And whilst you're at it, could you wrap PAYLOAD in parentheses?
>
> Will do!

Before I forget again... Is this what you had in mind?

Thanx, Paul

------------------------------------------------------------------------

key: Remove extraneous parentheses from rcu_assign_keypointer()

This commit removes the extraneous parentheses from rcu_assign_keypointer()
so that rcu_assign_pointer() can be wrapped in do-while. It also wraps
rcu_assign_keypointer() in a do-while and parenthesizes its final argument,
as suggested by David Howells.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>

diff --git a/include/linux/key.h b/include/linux/key.h
index 4cd22ed..e3dbc54 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -303,7 +303,9 @@ static inline bool key_is_instantiated(const struct key *key)
rwsem_is_locked(&((struct key *)(KEY))->sem)))

#define rcu_assign_keypointer(KEY, PAYLOAD) \
- (rcu_assign_pointer((KEY)->payload.rcudata, PAYLOAD))
+do { \
+ rcu_assign_pointer((KEY)->payload.rcudata, (PAYLOAD)) \
+while (0)

#ifdef CONFIG_SYSCTL
extern ctl_table key_sysctls[];

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/