diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-07-03 13:29:30 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-05-14 18:37:46 (GMT) |
commit | 7cab4adca3a4ce1cb773dd6f04d10a3d4c0206dd (patch) | |
tree | a8347ca4e9282c9f1fa295d59051296d5c40af9b /drivers | |
parent | b00da6bab40ac6f547cd21b36464dfef501783b9 (diff) | |
download | linux-fsl-qoriq-7cab4adca3a4ce1cb773dd6f04d10a3d4c0206dd.tar.xz |
drivers: random: Reduce preempt disabled region
No need to keep preemption disabled across the whole function.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/random.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 7a744d3..02172d2 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -673,9 +673,12 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) preempt_disable(); /* if over the trickle threshold, use only 1 in 4096 samples */ if (input_pool.entropy_count > trickle_thresh && - ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff)) - goto out; + ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff)) { + preempt_enable(); + return; + } + preempt_enable(); sample.jiffies = jiffies; sample.cycles = random_get_entropy(); sample.num = num; @@ -716,8 +719,6 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) credit_entropy_bits(&input_pool, min_t(int, fls(delta>>1), 11)); } -out: - preempt_enable(); } void add_input_randomness(unsigned int type, unsigned int code, |