diff mbox series

[28/74] backports: add get_random_u16()

Message ID 20240524190907.0ee01bdbffe9.Iac1c83457034d19878457df15d9f93a8c4781308@changeid (mailing list archive)
State New
Headers show
Series backport updates from Intel | expand

Commit Message

Johannes Berg May 24, 2024, 5:07 p.m. UTC
From: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/random.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/random.h b/backport/backport-include/linux/random.h
index 0a247321785a..89e9ce022505 100644
--- a/backport/backport-include/linux/random.h
+++ b/backport/backport-include/linux/random.h
@@ -3,6 +3,13 @@ 
 #include_next <linux/random.h>
 #include <linux/version.h>
 
+#if LINUX_VERSION_IS_LESS(6,1,0)
+static inline u16 get_random_u16(void)
+{
+	return get_random_int() & 0xffff;
+}
+#endif
+
 #if LINUX_VERSION_IS_LESS(6,2,0)
 static inline u32 get_random_u32_below(u32 ceil)
 {