summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-07-03 13:29:30 (GMT)
committerEmil Medve <Emilian.Medve@Freescale.com>2013-04-30 08:16:55 (GMT)
commit67a47d9fa0d9c1c7c90973cb3e57f8612397377f (patch)
tree51eb89ee0e9caf5fe5b3305b1c23a83a8b89f58a /drivers/char
parent543a01ffb0e31f7954e7e605ecd03b520710a1e7 (diff)
downloadlinux-fsl-qoriq-67a47d9fa0d9c1c7c90973cb3e57f8612397377f.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/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 32a6c57..50007e1 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -676,9 +676,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 = get_cycles();
sample.num = num;
@@ -719,8 +722,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,