reduce diff to linux
authorjsg <jsg@openbsd.org>
Thu, 28 Mar 2024 02:36:38 +0000 (02:36 +0000)
committerjsg <jsg@openbsd.org>
Thu, 28 Mar 2024 02:36:38 +0000 (02:36 +0000)
sys/dev/pci/drm/i915/gt/uc/intel_huc.c
sys/dev/pci/drm/include/linux/ktime.h

index 4ff193c..9c40964 100644 (file)
@@ -136,7 +136,7 @@ static void huc_delayed_load_timer_callback(void *arg)
 
 static void huc_delayed_load_start(struct intel_huc *huc)
 {
-       int delay;
+       ktime_t delay;
 
        GEM_BUG_ON(intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GSC));
 
@@ -146,10 +146,10 @@ static void huc_delayed_load_start(struct intel_huc *huc)
         */
        switch (huc->delayed_load.status) {
        case INTEL_HUC_WAITING_ON_GSC:
-               delay = GSC_INIT_TIMEOUT_MS;
+               delay = ms_to_ktime(GSC_INIT_TIMEOUT_MS);
                break;
        case INTEL_HUC_WAITING_ON_PXP:
-               delay = PXP_INIT_TIMEOUT_MS;
+               delay = ms_to_ktime(PXP_INIT_TIMEOUT_MS);
                break;
        default:
                gsc_init_error(huc);
@@ -171,7 +171,7 @@ static void huc_delayed_load_start(struct intel_huc *huc)
 #ifdef __linux__
        hrtimer_start(&huc->delayed_load.timer, delay, HRTIMER_MODE_REL);
 #else
-       timeout_add_msec(&huc->delayed_load.timer, delay);
+       timeout_add_nsec(&huc->delayed_load.timer, ktime_to_ns(delay));
 #endif
 }
 
index b3baf7a..f1d1c72 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ktime.h,v 1.7 2023/01/01 01:34:58 jsg Exp $   */
+/*     $OpenBSD: ktime.h,v 1.8 2024/03/28 02:36:38 jsg Exp $   */
 /*
  * Copyright (c) 2013, 2014, 2015 Mark Kettenis
  *
@@ -150,6 +150,12 @@ ns_to_ktime(uint64_t ns)
        return ns;
 }
 
+static inline ktime_t
+ms_to_ktime(uint64_t ms)
+{
+       return ms * NSEC_PER_MSEC;
+}
+
 static inline int64_t
 ktime_divns(ktime_t a, int64_t ns)
 {