lwtunnel: change prototype of lwtunnel_state_get()

It saves some lines and simplify a bit the code when the state is returning
by this function. It's also useful to handle a NULL entry.

To avoid too long lines, I've also renamed lwtunnel_state_get() and
lwtunnel_state_put() to lwtstate_get() and lwtstate_put().

CC: Thomas Graf <[email protected]>
CC: Roopa Prabhu <[email protected]>
Signed-off-by: Nicolas Dichtel <[email protected]>
Acked-by: Thomas Graf <[email protected]>
Acked-by: Roopa Prabhu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Nicolas Dichtel 2015-07-24 12:28:36 +02:00 • committed by David S. Miller
commit 5a6228a0b4
5 changed files with 20 additions and 24 deletions

View file

@ -178,7 +178,7 @@ static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt)
static void rt6_release(struct rt6_info *rt)
{
if (atomic_dec_and_test(&rt->rt6i_ref)) {
lwtunnel_state_put(rt->rt6i_lwtstate);
lwtstate_put(rt->rt6i_lwtstate);
rt6_free_pcpu(rt);
dst_free(&rt->dst);
}

View file

@ -1778,8 +1778,7 @@ int ip6_route_add(struct fib6_config *cfg)
cfg->fc_encap, &lwtstate);
if (err)
goto out;
lwtunnel_state_get(lwtstate);
rt->rt6i_lwtstate = lwtstate;
rt->rt6i_lwtstate = lwtstate_get(lwtstate);
if (lwtunnel_output_redirect(rt->rt6i_lwtstate))
rt->dst.output = lwtunnel_output6;
}
@ -2161,10 +2160,7 @@ static void ip6_rt_copy_init(struct rt6_info *rt, struct rt6_info *ort)
#endif
rt->rt6i_prefsrc = ort->rt6i_prefsrc;
rt->rt6i_table = ort->rt6i_table;
if (ort->rt6i_lwtstate) {
lwtunnel_state_get(ort->rt6i_lwtstate);
rt->rt6i_lwtstate = ort->rt6i_lwtstate;
}
rt->rt6i_lwtstate = lwtstate_get(ort->rt6i_lwtstate);
}
#ifdef CONFIG_IPV6_ROUTE_INFO