diff options
Diffstat (limited to 'include/linux/net.h')
-rw-r--r-- | include/linux/net.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index 94734a6259a4..17d83393afcc 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -248,24 +248,17 @@ do { \ | |||
248 | bool __net_get_random_once(void *buf, int nbytes, bool *done, | 248 | bool __net_get_random_once(void *buf, int nbytes, bool *done, |
249 | struct static_key *done_key); | 249 | struct static_key *done_key); |
250 | 250 | ||
251 | #ifdef HAVE_JUMP_LABEL | ||
252 | #define ___NET_RANDOM_STATIC_KEY_INIT ((struct static_key) \ | ||
253 | { .enabled = ATOMIC_INIT(0), .entries = (void *)1 }) | ||
254 | #else /* !HAVE_JUMP_LABEL */ | ||
255 | #define ___NET_RANDOM_STATIC_KEY_INIT STATIC_KEY_INIT_FALSE | ||
256 | #endif /* HAVE_JUMP_LABEL */ | ||
257 | |||
258 | #define net_get_random_once(buf, nbytes) \ | 251 | #define net_get_random_once(buf, nbytes) \ |
259 | ({ \ | 252 | ({ \ |
260 | bool ___ret = false; \ | 253 | bool ___ret = false; \ |
261 | static bool ___done = false; \ | 254 | static bool ___done = false; \ |
262 | static struct static_key ___done_key = \ | 255 | static struct static_key ___once_key = \ |
263 | ___NET_RANDOM_STATIC_KEY_INIT; \ | 256 | STATIC_KEY_INIT_TRUE; \ |
264 | if (!static_key_true(&___done_key)) \ | 257 | if (static_key_true(&___once_key)) \ |
265 | ___ret = __net_get_random_once(buf, \ | 258 | ___ret = __net_get_random_once(buf, \ |
266 | nbytes, \ | 259 | nbytes, \ |
267 | &___done, \ | 260 | &___done, \ |
268 | &___done_key); \ | 261 | &___once_key); \ |
269 | ___ret; \ | 262 | ___ret; \ |
270 | }) | 263 | }) |
271 | 264 | ||