Tue Apr 14 13:26:59 2015 UTC ()
Group initialization of rnd_samples and rnd_global.


(riastradh)
diff -r1.58 -r1.59 src/sys/kern/kern_rndq.c

cvs diff -r1.58 -r1.59 src/sys/kern/Attic/kern_rndq.c (expand / switch to context diff)
--- src/sys/kern/Attic/kern_rndq.c 2015/04/14 13:23:25 1.58
+++ src/sys/kern/Attic/kern_rndq.c 2015/04/14 13:26:58 1.59
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.58 2015/04/14 13:23:25 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.59 2015/04/14 13:26:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.58 2015/04/14 13:23:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.59 2015/04/14 13:26:58 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -495,20 +495,22 @@
 	if (rnd_ready)
 		return;
 
-	mutex_init(&rnd_samples.lock, MUTEX_DEFAULT, IPL_VM);
-	rndsinks_init();
-
 	/*
 	 * take a counter early, hoping that there's some variance in
 	 * the following operations
 	 */
 	c = rnd_counter();
 
-	LIST_INIT(&rnd_global.sources);
+	rndsinks_init();
+
+	/* Initialize the sample queue.  */
+	mutex_init(&rnd_samples.lock, MUTEX_DEFAULT, IPL_VM);
 	SIMPLEQ_INIT(&rnd_samples.q);
 
-	rndpool_init(&rnd_global.pool);
+	/* Initialize the global pool and sources list.  */
 	mutex_init(&rnd_global.lock, MUTEX_DEFAULT, IPL_VM);
+	rndpool_init(&rnd_global.pool);
+	LIST_INIT(&rnd_global.sources);
 
 	rnd_mempc = pool_cache_init(sizeof(rnd_sample_t), 0, 0, 0,
 				    "rndsample", NULL, IPL_VM,