Merge branch 'omap-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
[pandora-kernel.git] / lib / random32.c
index 4a15ce5..ca87d86 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/types.h>
 #include <linux/percpu.h>
 #include <linux/module.h>
+#include <linux/jiffies.h>
 #include <linux/random.h>
 
 struct rnd_state {
@@ -96,13 +97,18 @@ EXPORT_SYMBOL(random32);
  *     @seed: seed value
  *
  *     Add some additional seeding to the random32() pool.
- *     Note: this pool is per cpu so it only affects current CPU.
  */
 void srandom32(u32 entropy)
 {
-       struct rnd_state *state = &get_cpu_var(net_rand_state);
-       __set_random32(state, state->s1 ^ entropy);
-       put_cpu_var(state);
+       int i;
+       /*
+        * No locking on the CPUs, but then somewhat random results are, well,
+        * expected.
+        */
+       for_each_possible_cpu (i) {
+               struct rnd_state *state = &per_cpu(net_rand_state, i);
+               __set_random32(state, state->s1 ^ entropy);
+       }
 }
 EXPORT_SYMBOL(srandom32);