mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
ODROID: Remove rng_is_initialized function.
net/wireguard/compat/compat.h:319:20: error: static declaration of ‘rng_is_initialized’ follows non-static declaration
static inline bool rng_is_initialized(void)
^~~~~~~~~~~~~~~~~~
Change-Id: Ie59b676642fa9c114277015ff15c7c295912e805
This commit is contained in:
@@ -316,35 +316,6 @@ static inline void rng_is_initialized_callback(struct random_ready_callback *cb)
|
||||
atomic_set(rdy->rng_state, 2);
|
||||
kfree(rdy);
|
||||
}
|
||||
static inline bool rng_is_initialized(void)
|
||||
{
|
||||
static atomic_t rng_state = ATOMIC_INIT(0);
|
||||
|
||||
if (atomic_read(&rng_state) == 2)
|
||||
return true;
|
||||
|
||||
if (atomic_cmpxchg(&rng_state, 0, 1) == 0) {
|
||||
int ret;
|
||||
struct rng_is_initialized_callback *rdy = kmalloc(sizeof(*rdy), GFP_ATOMIC);
|
||||
if (!rdy) {
|
||||
atomic_set(&rng_state, 0);
|
||||
return false;
|
||||
}
|
||||
rdy->cb.owner = THIS_MODULE;
|
||||
rdy->cb.func = rng_is_initialized_callback;
|
||||
rdy->rng_state = &rng_state;
|
||||
ret = add_random_ready_callback(&rdy->cb);
|
||||
if (ret)
|
||||
kfree(rdy);
|
||||
if (ret == -EALREADY) {
|
||||
atomic_set(&rng_state, 2);
|
||||
return true;
|
||||
} else if (ret)
|
||||
atomic_set(&rng_state, 0);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
|
||||
/* This is a disaster. Without this API, we really have no way of
|
||||
* knowing if it's initialized. We just return that it has and hope
|
||||
|
||||
Reference in New Issue
Block a user