summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-07-03 08:29:30 -0500
committerClark Williams <williams@redhat.com>2011-12-28 16:25:22 -0600
commit658f9ec6096b10230459c0e1efa5960aefc8cf90 (patch)
tree84222c9ac280d2beaee43cc8b71f36a7f44e032f /drivers/char
parent7034fff43ceab4a68c80403bc65e036edaa13fde (diff)
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/char')
-rw-r--r--drivers/char/random.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 6035ab8d5ef7..786a856d59ba 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -633,8 +633,11 @@ 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 = get_cycles();
@@ -676,8 +679,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,