summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2025-09-04 20:27:48 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-01-16 19:37:49 +0000
commitfa3f62df151532a2e6b2934d5d5dc632b923c2b5 (patch)
tree70015dd0549b875d5634ff24f6861305726d75f4
parent4a3facee3ce66fedaafbb10dd2c927f001af2b7e (diff)
LinuxKPI: maths64: implement roundup_u64()
Needed by a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52080 (cherry picked from commit 2a44e10edb13e6b2be7fa2814b418a6959cb1171) (cherry picked from commit 88122c8eb70d81decb7c6dd16e551c3df6ad3818)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/math64.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/math64.h b/sys/compat/linuxkpi/common/include/linux/math64.h
index cae5e30b08df..0d6048454296 100644
--- a/sys/compat/linuxkpi/common/include/linux/math64.h
+++ b/sys/compat/linuxkpi/common/include/linux/math64.h
@@ -96,6 +96,12 @@ div64_u64_round_up(uint64_t dividend, uint64_t divisor)
return ((dividend + divisor - 1) / divisor);
}
+static inline uint64_t
+roundup_u64(uint64_t x1, uint32_t x2)
+{
+ return (div_u64(x1 + x2 - 1, x2) * x2);
+}
+
#define DIV64_U64_ROUND_UP(...) \
div64_u64_round_up(__VA_ARGS__)