1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

add hrtimer_forward_now() for 6.18.34 drm

This commit is contained in:
jsg
2026-06-02 03:17:28 +00:00
parent 26a119b535
commit 75706d555c
2 changed files with 19 additions and 3 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: drm_linux.c,v 1.137 2026/04/28 03:44:14 jsg Exp $ */
/* $OpenBSD: drm_linux.c,v 1.138 2026/06/02 03:17:28 jsg Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -3650,6 +3650,19 @@ seq_buf_printf(struct seq_buf *s, const char *fmt, ...)
}
}
u64
hrtimer_forward_now(struct timeout *to, ktime_t val)
{
struct timespec now, ts;
getnanotime(&now);
NSEC_TO_TIMESPEC(ktime_to_ns(val), &ts);
timespecadd(&ts, &now, &ts);
timeout_abs_ts(to, &ts);
return 0;
}
#ifdef __HAVE_FDT
#include <dev/ofw/openfirm.h>
+5 -2
View File
@@ -3,10 +3,11 @@
#ifndef _LINUX_HRTIMER_H
#define _LINUX_HRTIMER_H
#include <sys/types.h>
#include <sys/timeout.h>
#include <linux/types.h>
#include <linux/rbtree.h>
#include <sys/timeout.h>
enum hrtimer_restart { HRTIMER_NORESTART, HRTIMER_RESTART };
struct hrtimer {
enum hrtimer_restart (*function)(struct hrtimer *);
@@ -18,4 +19,6 @@ struct hrtimer {
#define hrtimer_try_to_cancel(x) timeout_del(x) /* XXX ret -1 if running */
#define hrtimer_active(x) timeout_pending(x)
u64 hrtimer_forward_now(struct timeout *, ktime_t);
#endif