diff mbox series

[30/47] headers: Add get_unaligned_be24

Message ID 20211019214320.2035704-31-hauke@hauke-m.de (mailing list archive)
State New, archived
Headers show
Series backports: Update to kernel 5.15-rc6 | expand

Commit Message

Hauke Mehrtens Oct. 19, 2021, 9:43 p.m. UTC
The get_unaligned_be24 function was added with kernel 5.7 to the general
header files and is now used by rtl8723bs.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/asm/unaligned.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 backport/backport-include/asm/unaligned.h
diff mbox series

Patch

diff --git a/backport/backport-include/asm/unaligned.h b/backport/backport-include/asm/unaligned.h
new file mode 100644
index 00000000..4e2a6a41
--- /dev/null
+++ b/backport/backport-include/asm/unaligned.h
@@ -0,0 +1,17 @@ 
+#ifndef __BACKPORT_ASM_GENERIC_UNALIGNED_H
+#define __BACKPORT_ASM_GENERIC_UNALIGNED_H
+#include_next <asm/unaligned.h>
+
+#if LINUX_VERSION_IS_LESS(5,7,0)
+static inline u32 __get_unaligned_be24(const u8 *p)
+{
+	return p[0] << 16 | p[1] << 8 | p[2];
+}
+
+static inline u32 get_unaligned_be24(const void *p)
+{
+	return __get_unaligned_be24(p);
+}
+#endif /* < 5.7 */
+
+#endif /* __BACKPORT_ASM_GENERIC_UNALIGNED_H */