diff mbox series

[1/3] backports: add BITS_TO_BYTES()

Message ID 20240524201112.bfc1a1eeddfa.I6ae09dfd2061693745358ecdac5f703f96b07e00@changeid (mailing list archive)
State New, archived
Headers show
Series [1/3] backports: add BITS_TO_BYTES() | expand

Commit Message

Johannes Berg May 24, 2024, 6:11 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

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

Patch

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 */