staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / arch / s390 / include / asm / archrandom.h
blobc67b82dfa558ee6b32a56fa069a7ac426a5a7a1f
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Kernel interface for the s390 arch_random_* functions
5 * Copyright IBM Corp. 2017
7 * Author: Harald Freudenberger <freude@de.ibm.com>
9 */
11 #ifndef _ASM_S390_ARCHRANDOM_H
12 #define _ASM_S390_ARCHRANDOM_H
14 #ifdef CONFIG_ARCH_RANDOM
16 #include <linux/static_key.h>
17 #include <linux/atomic.h>
19 DECLARE_STATIC_KEY_FALSE(s390_arch_random_available);
20 extern atomic64_t s390_arch_random_counter;
22 bool s390_arch_random_generate(u8 *buf, unsigned int nbytes);
24 static inline bool arch_has_random(void)
26 return false;
29 static inline bool arch_has_random_seed(void)
31 if (static_branch_likely(&s390_arch_random_available))
32 return true;
33 return false;
36 static inline bool arch_get_random_long(unsigned long *v)
38 return false;
41 static inline bool arch_get_random_int(unsigned int *v)
43 return false;
46 static inline bool arch_get_random_seed_long(unsigned long *v)
48 if (static_branch_likely(&s390_arch_random_available)) {
49 return s390_arch_random_generate((u8 *)v, sizeof(*v));
51 return false;
54 static inline bool arch_get_random_seed_int(unsigned int *v)
56 if (static_branch_likely(&s390_arch_random_available)) {
57 return s390_arch_random_generate((u8 *)v, sizeof(*v));
59 return false;
62 #endif /* CONFIG_ARCH_RANDOM */
63 #endif /* _ASM_S390_ARCHRANDOM_H */