All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [Patch] use dynamic spinlock initialisation in
@ 2006-04-18 17:04 Eric Sesterhenn
  0 siblings, 0 replies; only message in thread
From: Eric Sesterhenn @ 2006-04-18 17:04 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]

hi,

according to http://lwn.net/Articles/2.6-kernel-api/ spin locks should be
initialized during runtime instead of compile time.

"Run-time initialization of spinlocks is being converted away from the
 assignment form (using SPIN_LOCK_UNLOCKED) to explicit spin_lock_init()
 calls. No noises have yet been made about removing SPIN_LOCK_INIT,
 but the writing should be considered to be on the wall. If and when
 the real-time preemption patches are merged, the assignment form
 may no longer be possible."

So here is a patch to convert drivers/char/random.c to spin_lock_init()
its boot tested, i was able to generate a gpg key and work some days
without noticing anything strange.

I did not move the init into init_std_data() because it also gets called,
when the entropy pool gets cleared, so it should match the original behaviour.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.17-rc1-git5/drivers/char/random.c.orig	2006-04-12 16:02:02.000000000 +0200
+++ linux-2.6.17-rc1-git5/drivers/char/random.c	2006-04-12 16:02:41.000000000 +0200
@@ -417,7 +417,6 @@ static struct entropy_store input_pool =
 	.poolinfo = &poolinfo_table[0],
 	.name = "input",
 	.limit = 1,
-	.lock = SPIN_LOCK_UNLOCKED,
 	.pool = input_pool_data
 };
 
@@ -426,7 +425,6 @@ static struct entropy_store blocking_poo
 	.name = "blocking",
 	.limit = 1,
 	.pull = &input_pool,
-	.lock = SPIN_LOCK_UNLOCKED,
 	.pool = blocking_pool_data
 };
 
@@ -434,7 +432,6 @@ static struct entropy_store nonblocking_
 	.poolinfo = &poolinfo_table[1],
 	.name = "nonblocking",
 	.pull = &input_pool,
-	.lock = SPIN_LOCK_UNLOCKED,
 	.pool = nonblocking_pool_data
 };
 
@@ -894,6 +891,9 @@ static void init_std_data(struct entropy
 
 static int __init rand_initialize(void)
 {
+	spin_lock_init(&input_pool.lock);
+	spin_lock_init(&blocking_pool.lock);
+	spin_lock_init(&nonblocking_pool.lock);
 	init_std_data(&input_pool);
 	init_std_data(&blocking_pool);
 	init_std_data(&nonblocking_pool);



[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-18 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-18 17:04 [KJ] [Patch] use dynamic spinlock initialisation in Eric Sesterhenn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.