clk: rockchip: add clock ids for efuse on RK3366
[firefly-linux-kernel-4.4.55.git] / drivers / char / random.c
index 491a4dce13fef5962a9b07d6cef5c82fc3fc31d8..d93dfebae0bba58a7634d8dfc8e76aa97c0e515c 100644 (file)
@@ -1824,6 +1824,28 @@ unsigned int get_random_int(void)
 }
 EXPORT_SYMBOL(get_random_int);
 
+/*
+ * Same as get_random_int(), but returns unsigned long.
+ */
+unsigned long get_random_long(void)
+{
+       __u32 *hash;
+       unsigned long ret;
+
+       if (arch_get_random_long(&ret))
+               return ret;
+
+       hash = get_cpu_var(get_random_int_hash);
+
+       hash[0] += current->pid + jiffies + random_get_entropy();
+       md5_transform(hash, random_int_secret);
+       ret = *(unsigned long *)hash;
+       put_cpu_var(get_random_int_hash);
+
+       return ret;
+}
+EXPORT_SYMBOL(get_random_long);
+
 /*
  * randomize_range() returns a start address such that
  *