blob: 22379822a353693a4a987fbf1795f1387302472b [file] [log] [blame]
From d7247f625be7fbb17960c14b006d4478a63862df Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 3 Jul 2009 08:29:30 -0500
Subject: [PATCH] drivers: random: Reduce preempt disabled region
commit be791b93a95b8a8808c2f15e1349843aa04e868c in tip.
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>
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 2849713..5e54b4b 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -625,8 +625,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 &&
- (__get_cpu_var(trickle_count)++ & 0xfff))
- goto out;
+ (__get_cpu_var(trickle_count)++ & 0xfff)) {
+ preempt_enable();
+ return;
+ }
+ preempt_enable();
sample.jiffies = jiffies;
sample.cycles = get_cycles();
@@ -668,8 +671,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,
--
1.7.1.1