git: a939c9544033 - stable/14 - LinuxKPI: add BITS_TO_BYTES()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 22 Apr 2024 19:43:57 UTC
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=a939c954403314318d64d848534a4f9e3578217a

commit a939c954403314318d64d848534a4f9e3578217a
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-04-02 23:48:05 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-04-22 16:59:40 +0000

    LinuxKPI: add BITS_TO_BYTES()
    
    Just like BITS_TO_LONG() ... used in rtw89.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D44603
    
    (cherry picked from commit f674f016c03d49e14f1c651ed088a6f2d01a62ee)
---
 sys/compat/linuxkpi/common/include/linux/bitops.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 58677631b604..1415d5224084 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -54,6 +54,7 @@
 #define	GENMASK_ULL(h, l)	(((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
 #define	BITS_PER_BYTE		8
 #define	BITS_PER_TYPE(t)	(sizeof(t) * BITS_PER_BYTE)
+#define	BITS_TO_BYTES(n)	howmany((n), BITS_PER_BYTE)
 
 #define	hweight8(x)	bitcount((uint8_t)(x))
 #define	hweight16(x)	bitcount16(x)