[PATCH i-g-t 2/3] lib/xe: replace div64_u64_round_up() with DIV_ROUND_UP

Shuicheng Lin shuicheng.lin at intel.com
Wed Apr 16 16:30:52 UTC 2025


DIV_ROUND_UP is defined in igt_aux.h with the same function as
div64_u64_round_up().

Cc: Matt Roper <matthew.d.roper at intel.com>
Signed-off-by: Shuicheng Lin <shuicheng.lin at intel.com>
---
 lib/xe/xe_util.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/xe/xe_util.c b/lib/xe/xe_util.c
index 06b378ce0..9907c8b16 100644
--- a/lib/xe/xe_util.c
+++ b/lib/xe/xe_util.c
@@ -253,14 +253,6 @@ static uint32_t reference_clock(int fd, int gt_id)
 	return refclock;
 }
 
-static uint64_t div64_u64_round_up(const uint64_t x, const uint64_t y)
-{
-	igt_assert(y > 0);
-	igt_assert_lte_u64(x, UINT64_MAX - (y - 1));
-
-	return (x + y - 1) / y;
-}
-
 /**
  * xe_nsec_to_ticks: convert time in nanoseconds to timestamp ticks
  * @fd: opened device
@@ -273,5 +265,5 @@ uint32_t xe_nsec_to_ticks(int fd, int gt_id, uint64_t nsec)
 {
 	uint32_t refclock = reference_clock(fd, gt_id);
 
-	return div64_u64_round_up(nsec * refclock, NSEC_PER_SEC);
+	return DIV_ROUND_UP(nsec * refclock, NSEC_PER_SEC);
 }
-- 
2.25.1



More information about the igt-dev mailing list