Subject: Re: [RFC] fib_trie: whitespace cleanup

From: "Paul E. McKenney" <[email-masked]>
Date: Mon, 30 Jul 2007 10:07:34 -0700

On Thu, Jul 26, 2007 at 09:56:30PM -0700, Andrew Morton wrote:
> On Thu, 26 Jul 2007 08:44:21 -0700 "Paul E. McKenney" <[email-masked]> wrote:
> 
> > On Thu, Jul 26, 2007 at 11:49:42AM +0100, Stephen Hemminger wrote:
> > > Whitespace cleanup run code through lindent then cleanup results.
> > > Applys after other two patches.
> > > 
> > > --- a/net/ipv4/fib_trie.c	2007-07-26 10:17:21.000000000 +0100
> > > +++ b/net/ipv4/fib_trie.c	2007-07-26 11:47:52.000000000 +0100
> > > @@ -156,7 +156,8 @@ struct trie {
> > >  };
> > > 
> > >  static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n);
> > > -static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull);
> > > +static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n,
> > > +				  int wasfull);
> > >  static struct node *resize(struct trie *t, struct tnode *tn);
> > >  static struct tnode *inflate(struct trie *t, struct tnode *tn);
> > >  static struct tnode *halve(struct trie *t, struct tnode *tn);
> > > @@ -167,13 +168,12 @@ static struct trie *trie_local = NULL, *
> > > 
> > >  static inline struct tnode *node_parent(struct node *node)
> > >  {
> > > -	return rcu_dereference((struct tnode *) (node->parent & ~NODE_TYPE_MASK));
> > > +	return rcu_dereference((struct tnode *)(node->parent & ~NODE_TYPE_MASK));
> > 
> > The potential issue is applying rcu_dereference() to an rvalue
> > as opposed to an lvalue.  So how about the following?
> > 
> 
> I did this:
> 
> static inline struct tnode *node_parent(struct node *node)
> {
> 	struct tnode *ret;
> 
> 	ret = (struct tnode *)(node->parent & ~NODE_TYPE_MASK);
> 	return rcu_dereference(ret);
> }

I would feel more comfortable with the rcu_dereference() covering the
initial fetch from node->parent, but do not have any hard objections
to your approach.

						Thanx, Paul