Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2026 18:10:28 +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-main@FreeBSD.org
Subject:   git: 002c08158f9e - main - linuxkpi: Define `DIV_U64_ROUND_UP()`
Message-ID:  <69e90f14.4570d.30595852@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by dumbbell:

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

commit 002c08158f9e7eb61c467fe29ff8e24361fb8470
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-22 18:09:56 +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
    Differential Revision: https://reviews.freebsd.org/D56576
---
 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?69e90f14.4570d.30595852>