* [PATCH 1/3] drivers/char/random.c: constify poolinfo_table
@ 2018-11-02 11:04 Rasmus Villemoes
2018-11-02 11:04 ` [PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits Rasmus Villemoes
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rasmus Villemoes @ 2018-11-02 11:04 UTC (permalink / raw)
To: Theodore Ts'o, Arnd Bergmann, Greg Kroah-Hartman
Cc: Rasmus Villemoes, linux-kernel
Never modified, might as well be put in .rodata.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/char/random.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 2eb70e76ed35..320108df04c1 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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;
--
2.19.1.6.gbde171bbf5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits
2018-11-02 11:04 [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Rasmus Villemoes
@ 2018-11-02 11:04 ` Rasmus Villemoes
2018-11-07 22:11 ` Theodore Y. Ts'o
2018-11-02 11:04 ` [PATCH 3/3] drivers/char/random.c: make primary_crng static Rasmus Villemoes
2018-11-07 22:11 ` [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Theodore Y. Ts'o
2 siblings, 1 reply; 6+ messages in thread
From: Rasmus Villemoes @ 2018-11-02 11:04 UTC (permalink / raw)
To: Theodore Ts'o, Arnd Bergmann, Greg Kroah-Hartman
Cc: Rasmus Villemoes, linux-kernel
This field is never used, might as well remove it.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/char/random.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 320108df04c1..1b2e1580b4b5 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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 */
--
2.19.1.6.gbde171bbf5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] drivers/char/random.c: make primary_crng static
2018-11-02 11:04 [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Rasmus Villemoes
2018-11-02 11:04 ` [PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits Rasmus Villemoes
@ 2018-11-02 11:04 ` Rasmus Villemoes
2018-11-07 22:11 ` Theodore Y. Ts'o
2018-11-07 22:11 ` [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Theodore Y. Ts'o
2 siblings, 1 reply; 6+ messages in thread
From: Rasmus Villemoes @ 2018-11-02 11:04 UTC (permalink / raw)
To: Theodore Ts'o, Arnd Bergmann, Greg Kroah-Hartman
Cc: Rasmus Villemoes, linux-kernel
Since 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.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/char/random.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 1b2e1580b4b5..0a381897e4a5 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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),
};
--
2.19.1.6.gbde171bbf5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] drivers/char/random.c: constify poolinfo_table
2018-11-02 11:04 [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Rasmus Villemoes
2018-11-02 11:04 ` [PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits Rasmus Villemoes
2018-11-02 11:04 ` [PATCH 3/3] drivers/char/random.c: make primary_crng static Rasmus Villemoes
@ 2018-11-07 22:11 ` Theodore Y. Ts'o
2 siblings, 0 replies; 6+ messages in thread
From: Theodore Y. Ts'o @ 2018-11-07 22:11 UTC (permalink / raw)
To: Rasmus Villemoes; +Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel
On Fri, Nov 02, 2018 at 12:04:45PM +0100, Rasmus Villemoes wrote:
> Never modified, might as well be put in .rodata.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-11-07 22:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 11:04 [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Rasmus Villemoes
2018-11-02 11:04 ` [PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits Rasmus Villemoes
2018-11-07 22:11 ` Theodore Y. Ts'o
2018-11-02 11:04 ` [PATCH 3/3] drivers/char/random.c: make primary_crng static Rasmus Villemoes
2018-11-07 22:11 ` Theodore Y. Ts'o
2018-11-07 22:11 ` [PATCH 1/3] drivers/char/random.c: constify poolinfo_table Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).