Commit 7b878d4b48c4e04b936918bb83836a107ba453b3
Committed by
Theodore Ts'o
1 parent
331c6490c7
Exists in
master
and in
13 other branches
random: Add arch_has_random[_seed]()
Add predicate functions for having arch_get_random[_seed]*(). The only current use is to avoid the loop in arch_random_refill() when arch_get_random_seed_long() is unavailable. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Showing 4 changed files with 23 additions and 0 deletions Side-by-side Diff
arch/powerpc/include/asm/archrandom.h
... | ... | @@ -25,6 +25,11 @@ |
25 | 25 | return rc; |
26 | 26 | } |
27 | 27 | |
28 | +static inline int arch_has_random(void) | |
29 | +{ | |
30 | + return !!ppc_md.get_random_long; | |
31 | +} | |
32 | + | |
28 | 33 | int powernv_get_random_long(unsigned long *v); |
29 | 34 | |
30 | 35 | static inline int arch_get_random_seed_long(unsigned long *v) |
... | ... | @@ -32,6 +37,10 @@ |
32 | 37 | return 0; |
33 | 38 | } |
34 | 39 | static inline int arch_get_random_seed_int(unsigned int *v) |
40 | +{ | |
41 | + return 0; | |
42 | +} | |
43 | +static inline int arch_has_random_seed(void) | |
35 | 44 | { |
36 | 45 | return 0; |
37 | 46 | } |
arch/x86/include/asm/archrandom.h
drivers/char/random.c
include/linux/random.h
... | ... | @@ -88,11 +88,19 @@ |
88 | 88 | { |
89 | 89 | return 0; |
90 | 90 | } |
91 | +static inline int arch_has_random(void) | |
92 | +{ | |
93 | + return 0; | |
94 | +} | |
91 | 95 | static inline int arch_get_random_seed_long(unsigned long *v) |
92 | 96 | { |
93 | 97 | return 0; |
94 | 98 | } |
95 | 99 | static inline int arch_get_random_seed_int(unsigned int *v) |
100 | +{ | |
101 | + return 0; | |
102 | +} | |
103 | +static inline int arch_has_random_seed(void) | |
96 | 104 | { |
97 | 105 | return 0; |
98 | 106 | } |