nsecs_to_jiffies_timeout() originated here and has since been copied into
another driver. It is now available in "drm_timeout.c", so use it and drop
the local definition.

Signed-off-by: Maíra Canal <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_wait.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_wait.c 
b/drivers/gpu/drm/i915/gem/i915_gem_wait.c
index 2893df65c359..1c189d4d7ad8 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_wait.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_wait.c
@@ -7,6 +7,8 @@
 #include <linux/dma-fence-chain.h>
 #include <linux/jiffies.h>
 
+#include <drm/drm_utils.h>
+
 #include "gt/intel_engine.h"
 #include "gt/intel_rps.h"
 
@@ -184,25 +186,12 @@ i915_gem_object_wait(struct drm_i915_gem_object *obj,
        return !timeout ? -ETIME : 0;
 }
 
-static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
-{
-       /* nsecs_to_jiffies64() does not guard against overflow */
-       if ((NSEC_PER_SEC % HZ) != 0 &&
-           div_u64(n, NSEC_PER_SEC) >= MAX_JIFFY_OFFSET / HZ)
-               return MAX_JIFFY_OFFSET;
-
-       return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
-}
-
 static unsigned long to_wait_timeout(s64 timeout_ns)
 {
        if (timeout_ns < 0)
                return MAX_SCHEDULE_TIMEOUT;
 
-       if (timeout_ns == 0)
-               return 0;
-
-       return nsecs_to_jiffies_timeout(timeout_ns);
+       return drm_timeout_rel_to_jiffies(timeout_ns);
 }
 
 /**

-- 
2.55.0

Reply via email to