[PATCH 1/3] backports: add BITS_TO_BYTES()

Johannes Berg <[email protected]> Fri, 24 May 2024 20:11:11 +0200
Newsgroups org.kernel.vger.backports
Message-ID <20240524201112.bfc1a1eeddfa.I6ae09dfd2061693745358ecdac5f703f96b07e00@changeid>
From: Johannes Berg <[email protected]>

Signed-off-by: Johannes Berg <[email protected]>
---
 backport/backport-include/linux/bitops.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backport/backport-include/linux/bitops.h b/backport/backport-include/linux/bitops.h
index 17bd8138ecd6..20890e198ee5 100644
--- a/backport/backport-include/linux/bitops.h
+++ b/backport/backport-include/linux/bitops.h
@@ -24,4 +24,8 @@
 #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
 #endif
 
+#ifndef BITS_TO_BYTES
+#define BITS_TO_BYTES(nr)	__KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
+#endif
+
 #endif /* __BACKPORT_BITOPS_H */
-- 
2.45.1