[PATCH 5/10] random pt2: simplify initialization

From: Matt Mackall
Date: Fri Jan 14 2005 - 20:07:12 EST


Simplify the init code

Signed-off-by: Matt Mackall <mpm@xxxxxxxxxxx>

Index: rnd/drivers/char/random.c
===================================================================
--- rnd.orig/drivers/char/random.c 2005-01-12 21:28:02.593185340 -0800
+++ rnd/drivers/char/random.c 2005-01-12 21:28:03.909017586 -0800
@@ -1485,9 +1485,6 @@
static void init_std_data(struct entropy_store *r)
{
struct timeval tv;
- __u32 words[2];
- char *p;
- int i;
unsigned long flags;

spin_lock_irqsave(&r->lock, flags);
@@ -1495,20 +1492,9 @@
spin_unlock_irqrestore(&r->lock, flags);

do_gettimeofday(&tv);
- words[0] = tv.tv_sec;
- words[1] = tv.tv_usec;
- add_entropy_words(r, words, 2);
-
- /*
- * This doesn't lock system.utsname. However, we are generating
- * entropy so a race with a name set here is fine.
- */
- p = (char *) &system_utsname;
- for (i = sizeof(system_utsname) / sizeof(words); i; i--) {
- memcpy(words, p, sizeof(words));
- add_entropy_words(r, words, sizeof(words)/4);
- p += sizeof(words);
- }
+ add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4);
+ add_entropy_words(r, (__u32 *)&system_utsname,
+ sizeof(system_utsname)/4);
}

static int __init rand_initialize(void)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/