Subject: Re: [RFC] fib_trie: whitespace cleanup

From: Andrew Morton <[email-masked]>
Date: Thu, 26 Jul 2007 21:56:30 -0700

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);
}