Skip to contentSkip to conversation

net, lib/once: Remove {net_}get_random_once_wait macro

PATCH Applied wuchi 2 participants 2 messages Jun 19, 2022 Networking

lore
Share & tools
lore

wuchi

author
#0 lore raw

PATCH 1/1 net, lib/once: Remove {net_}get_random_once_wait macro

DO_ONCE(func, ...) will call func with spinlock which acquired by spin_lock_irqsave in __do_once_start. But the get_random_once_wait will sleep in get_random_bytes_wait -> wait_for_random_bytes.

Fortunately, there is no place to use {net_}get_random_once_wait, so we could remove them simply.

---
 include/linux/net.h  | 2 --
 include/linux/once.h | 2 --
 2 files changed, 4 deletions(-)
include/linux/net.h +0 -2
index 12093f4db50c..8613772a1f58 100644
@@ -303,8 +303,6 @@ do {									\
 
 #define net_get_random_once(buf, nbytes)			\
 	get_random_once((buf), (nbytes))
-#define net_get_random_once_wait(buf, nbytes)			\
-	get_random_once_wait((buf), (nbytes))
 
 /*
  * E.g. XFS meta- & log-data is in slab pages, or bcache meta
include/linux/once.h +0 -2
index f54523052bbc..b14d8b309d52 100644
@@ -54,7 +54,5 @@ void __do_once_done(bool *done, struct static_key_true *once_key,
 
 #define get_random_once(buf, nbytes)					     \
 	DO_ONCE(get_random_bytes, (buf), (nbytes))
-#define get_random_once_wait(buf, nbytes)                                    \
-	DO_ONCE(get_random_bytes_wait, (buf), (nbytes))                      \
 
 #endif /* _LINUX_ONCE_H */
Signature · 1 line
2.20.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Sun, 19 Jun 2022 15:46:41 +0800 wuchi wrote:

DO_ONCE(func, ...) will call func with spinlock which acquired by spin_lock_irqsave in __do_once_start. But the get_random_once_wait will sleep in get_random_bytes_wait -> wait_for_random_bytes.

Fortunately, there is no place to use {net_}get_random_once_wait, so we could remove them simply.

Yeah, sure, if it builds:

If Andrew doesn't pick it you please repost CCing netdev.