drivers/char/random.c: constify poolinfo_table
PATCH 1/3 drivers/char/random.c: constify poolinfo_table
Never modified, might as well be put in .rodata.
--- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/random.c +1 -1
@@ -359,7 +359,7 @@ static int random_write_wakeup_bits = 28 * OUTPUT_POOL_WORDS;* polynomial which improves the resulting TGFSR polynomial to be * irreducible, which we have made here. */ -static struct poolinfo { +static const struct poolinfo { int poolbitshift, poolwords, poolbytes, poolbits, poolfracbits; #define S(x) ilog2(x)+5, (x), (x)*4, (x)*32, (x) << (ENTROPY_SHIFT+5) int tap1, tap2, tap3, tap4, tap5;
Signature · 1 line
2.19.1.6.gbde171bbf5
PATCH 2/3 drivers/char/random.c: remove unused stuct poolinfo::poolbits
This field is never used, might as well remove it.
--- drivers/char/random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/random.c +3 -3
@@ -295,7 +295,7 @@* To allow fractional bits to be tracked, the entropy_count field is * denominated in units of 1/8th bits. * -* 2*(ENTROPY_SHIFT + log2(poolbits)) must <= 31, or the multiply in +* 2*(ENTROPY_SHIFT + poolbitshift) must <= 31, or the multiply in * credit_entropy_bits() needs to be 64 bits wide. */ #define ENTROPY_SHIFT 3
@@ -360,8 +360,8 @@ static int random_write_wakeup_bits = 28 * OUTPUT_POOL_WORDS;* irreducible, which we have made here. */ static const struct poolinfo { -int poolbitshift, poolwords, poolbytes, poolbits, poolfracbits; -#define S (x) ilog2(x)+5, (x), (x)*4, (x)*32, (x) << (ENTROPY_SHIFT+5) +int poolbitshift, poolwords, poolbytes, poolfracbits; +#define S (x) ilog2(x)+5, (x), (x)*4, (x) << (ENTROPY_SHIFT+5)int tap1, tap2, tap3, tap4, tap5; } poolinfo_table[] = {/* was: x^128 + x^103 + x^76 + x^51 +x^25 + x + 1 */
Signature · 1 line
2.19.1.6.gbde171bbf5
Re: [PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits
Quoted 3 lines · Rasmus Villemoes
This field is never used, might as well remove it.
Signed-off-by Rasmus Villemoes <[email protected]>
Thanks, applied.
- Ted
PATCH 3/3 drivers/char/random.c: make primary_crng static
In reply to Rasmus VillemoesSince the definition of struct crng_state is private to random.c, and primary_crng is neither declared or used elsewhere, there's no reason for that symbol to have external linkage.
--- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/random.c +1 -1
@@ -415,7 +415,7 @@ struct crng_state {spinlock_t lock; }; -struct crng_state primary_crng = { +static struct crng_state primary_crng = { .lock =__SPIN_LOCK_UNLOCKED (primary_crng.lock), };
Signature · 1 line
2.19.1.6.gbde171bbf5
Re: [PATCH 3/3] drivers/char/random.c: make primary_crng static
Quoted 5 lines · Rasmus Villemoes
Since the definition of struct
crng_stateis private torandom.c, andprimary_crngis neither declared or used elsewhere, there's no reason for that symbol to have external linkage.Signed-off-by Rasmus Villemoes <[email protected]>
Thanks, applied.
- Ted
Quoted 3 lines · Rasmus Villemoes
Never modified, might as well be put in .rodata.
Signed-off-by Rasmus Villemoes <[email protected]>
Thanks, applied.
- Ted