Date: Wed, 29 Apr 2026 21:43:05 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 34a73bf20c96 - stable/15 - linuxkpi: Define `DIV_U64_ROUND_UP()` Message-ID: <69f27b69.18e87.7b5c47c6@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=34a73bf20c9694ca1d511f2cfeb2b7e5217c36a7 commit 34a73bf20c9694ca1d511f2cfeb2b7e5217c36a7 Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-21 00:32:18 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-29 21:04:04 +0000 linuxkpi: Define `DIV_U64_ROUND_UP()` It is the same as `DIV64_U64_ROUND_UP()` but takes a 32-bit integer as the divisor. The amdgpu DRM driver started to use this in Linux 6.12.x. Reviewed by: bz Sponsored by: The FreeBSD Foundation (cherry picked from commit 002c08158f9e7eb61c467fe29ff8e24361fb8470) --- sys/compat/linuxkpi/common/include/linux/math64.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/math64.h b/sys/compat/linuxkpi/common/include/linux/math64.h index 25ca9da1b622..e35aae67fa27 100644 --- a/sys/compat/linuxkpi/common/include/linux/math64.h +++ b/sys/compat/linuxkpi/common/include/linux/math64.h @@ -92,6 +92,12 @@ mul_u32_u32(uint32_t a, uint32_t b) return ((uint64_t)a * b); } +static inline uint64_t +div_u64_round_up(uint64_t dividend, uint32_t divisor) +{ + return ((dividend + divisor - 1) / divisor); +} + static inline uint64_t div64_u64_round_up(uint64_t dividend, uint64_t divisor) { @@ -104,6 +110,9 @@ roundup_u64(uint64_t x1, uint32_t x2) return (div_u64(x1 + x2 - 1, x2) * x2); } +#define DIV_U64_ROUND_UP(...) \ + div_u64_round_up(__VA_ARGS__) + #define DIV64_U64_ROUND_UP(...) \ div64_u64_round_up(__VA_ARGS__)home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f27b69.18e87.7b5c47c6>
