get_random_int() was present, but simply not exported for use in modules
until 3.10.  Implement it in terms of the more expensive get_random_bytes()

This is needed by the cw1200 driver.

Signed-off-by: Solomon Peachy <[email protected]>
---
 backport/compat/backport-3.10.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c
index 980ed59..5273758 100644
--- a/backport/compat/backport-3.10.c
+++ b/backport/compat/backport-3.10.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/proc_fs.h>
+#include <linux/random.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
 #include <linux/init.h>
@@ -77,3 +78,15 @@ void proc_set_user(struct proc_dir_entry *de, kuid_t uid, 
kgid_t gid)
        de->gid = gid;
 }
 EXPORT_SYMBOL_GPL(proc_set_user);
+
+/* get_random_int() was not exported for module use until 3.10-rc.
+   Implement it here in terms of the more expensive get_random_bytes()
+ */
+unsigned int get_random_int(void)
+{
+       unsigned int r;
+       get_random_bytes(&r, sizeof(r));
+
+       return r;
+}
+EXPORT_SYMBOL_GPL(get_random_int);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to