[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120615205012.GJ31184@leaf>
Date: Fri, 15 Jun 2012 13:50:12 -0700
From: Josh Triplett <josh@...htriplett.org>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
dipankar@...ibm.com, akpm@...ux-foundation.org,
mathieu.desnoyers@...ymtl.ca, niv@...ibm.com, tglx@...utronix.de,
peterz@...radead.org, rostedt@...dmis.org, Valdis.Kletnieks@...edu,
dhowells@...hat.com, eric.dumazet@...il.com, darren@...art.com,
fweisbec@...il.com, patches@...aro.org
Subject: Re: [PATCH tip/core/rcu 06/14] rcu: Remove return value from
RCU_INIT_POINTER()
On Fri, Jun 15, 2012 at 01:13:07PM -0700, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
>
> The return value from RCU_INIT_POINTER() is not used, and using it
> would be quite ugly, for example:
>
> q = RCU_INIT_POINTER(global_p, p);
>
> To prevent this sort of ugliness from appearing, this commit wraps
> RCU_INIT_POINTER() in a do-while loop.
>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@...htriplett.org>
> include/linux/rcupdate.h | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index eb92c21..f2cca02 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -904,7 +904,9 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
> * the reader-accessible portions of the linked structure.
> */
> #define RCU_INIT_POINTER(p, v) \
> - p = (typeof(*v) __force __rcu *)(v)
> + do { \
> + p = (typeof(*v) __force __rcu *)(v); \
> + } while (0)
>
> /**
> * INIT_RCU_POINTER() - statically initialize an RCU protected pointer
> --
> 1.7.8
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists