summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYangtao Li <tiny.windzz@gmail.com>2019-06-07 20:25:14 +0200
committerTheodore Ts'o <tytso@mit.edu>2020-01-07 22:33:18 +0100
commit12faac30d157970fdbfa171bbeb1fb88350303b1 (patch)
tree5a453ab4db89f80a20e1e551d0b85e65de0ef8fa
parentrandom: remove unnecessary unlikely() (diff)
downloadlinux-12faac30d157970fdbfa171bbeb1fb88350303b1.tar.xz
linux-12faac30d157970fdbfa171bbeb1fb88350303b1.zip
random: convert to ENTROPY_BITS for better code readability
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Link: https://lore.kernel.org/r/20190607182517.28266-2-tiny.windzz@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--drivers/char/random.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index e3309ce12f1d..f75f39b354b3 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -760,7 +760,7 @@ retry:
if (entropy_bits < 128)
return;
crng_reseed(&primary_crng, r);
- entropy_bits = r->entropy_count >> ENTROPY_SHIFT;
+ entropy_bits = ENTROPY_BITS(r);
}
}
}
@@ -1378,8 +1378,7 @@ retry:
goto retry;
trace_debit_entropy(r->name, 8 * ibytes);
- if (ibytes &&
- (r->entropy_count >> ENTROPY_SHIFT) < random_write_wakeup_bits) {
+ if (ibytes && ENTROPY_BITS(r) < random_write_wakeup_bits) {
wake_up_interruptible(&random_write_wait);
kill_fasync(&fasync, SIGIO, POLL_OUT);
}