Subject: Re: [PATCH net-next 4/5] random32: add prandom_init_once helper for own rngs

From: Alexei Starovoitov <[email-masked]>
Date: Wed, 7 Oct 2015 09:32:24 -0700

On 10/7/15 6:43 AM, Daniel Borkmann wrote:
> +void prandom_init_state_once(void *pcpu_state);
> +
> +#define prandom_init_once(pcpu_state)				\
> +	({ do_once(prandom_init_state_once, (pcpu_state)); })
>
>   /**
>    * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
> diff --git a/lib/random32.c b/lib/random32.c
> index 36c09fb..b166237 100644
> --- a/lib/random32.c
> +++ b/lib/random32.c
> @@ -256,6 +256,11 @@ static void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state)
>   	}
>   }
>
> +void prandom_init_state_once(void *pcpu_state)
> +{
> +	prandom_seed_full_state((struct rnd_state __percpu *)pcpu_state);
> +}
> +

prandom_seed_full_state() is likely not inlined in the above.
Why introduce this helper instead of making prandom_seed_full_state() 
global? with my other suggestion the void cast will be avoided as well
and compiler will do type checking.