diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/nomadik-rng.c | 2 | ||||
-rw-r--r-- | drivers/char/random.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/drivers/char/hw_random/nomadik-rng.c b/drivers/char/hw_random/nomadik-rng.c index 52e08ca3ccd7..3d3c1e6703b4 100644 --- a/drivers/char/hw_random/nomadik-rng.c +++ b/drivers/char/hw_random/nomadik-rng.c @@ -95,6 +95,8 @@ static struct amba_id nmk_rng_ids[] = { {0, 0}, }; +MODULE_DEVICE_TABLE(amba, nmk_rng_ids); + static struct amba_driver nmk_rng_driver = { .drv = { .owner = THIS_MODULE, diff --git a/drivers/char/random.c b/drivers/char/random.c index 6035ab8d5ef7..85da8740586b 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -624,8 +624,8 @@ static struct timer_rand_state input_timer_state; static void add_timer_randomness(struct timer_rand_state *state, unsigned num) { struct { - cycles_t cycles; long jiffies; + unsigned cycles; unsigned num; } sample; long delta, delta2, delta3; @@ -637,7 +637,11 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) goto out; sample.jiffies = jiffies; - sample.cycles = get_cycles(); + + /* Use arch random value, fall back to cycles */ + if (!arch_get_random_int(&sample.cycles)) + sample.cycles = get_cycles(); + sample.num = num; mix_pool_bytes(&input_pool, &sample, sizeof(sample)); |