All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels.
@ 2013-08-17  4:23 Solomon Peachy
  2013-08-17  4:23 ` [PATCH 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:23 UTC (permalink / raw)
  To: backports; +Cc: Solomon Peachy

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 <pizza@shaftnet.org>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-17  4:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-17  4:23 [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
2013-08-17  4:23 ` [PATCH 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
2013-08-17  4:23 ` [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
2013-08-17  4:26   ` Solomon Peachy
2013-08-17  4:34     ` Solomon Peachy
2013-08-17  4:23 ` [PATCH 4/4] backports: cw1200 requires >=2.6.35 Solomon Peachy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.