summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2019-06-24 21:44:20 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2019-07-06 11:47:22 +0200
commitee6e8da64b68cc0ce0343f986ebb9546f15f7cfb (patch)
tree355417db5bedfcbcae81081181f2e779f35c685b
parent381f4e96fb45671f2c211c8a67051f47e1c07b83 (diff)
header: add hrtimer_forward() and ns_to_ktime()
ktime_t was converted from the union to s64 in kernel 4.10. hrtimer_start() was already converted some time ago in backports, now mac80211_hwsim uses hrtimer_start() together with the newly added functions. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/interrupt.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/backport/backport-include/linux/interrupt.h b/backport/backport-include/linux/interrupt.h
index ad3cbf66..f7e7134d 100644
--- a/backport/backport-include/linux/interrupt.h
+++ b/backport/backport-include/linux/interrupt.h
@@ -5,6 +5,25 @@
#include <linux/ktime.h>
#if LINUX_VERSION_IS_LESS(4,10,0)
+
+/* Forward a hrtimer so it expires after now: */
+static inline u64
+backport_hrtimer_forward(struct hrtimer *timer, ktime_t now, s64 interval)
+{
+ ktime_t _interval = { .tv64 = interval };
+
+ return hrtimer_forward(timer, now, _interval);
+}
+#define hrtimer_forward LINUX_BACKPORT(hrtimer_forward)
+
+static inline s64 backport_ns_to_ktime(u64 ns)
+{
+ ktime_t _time = ns_to_ktime(ns);
+
+ return _time.tv64;
+}
+#define ns_to_ktime LINUX_BACKPORT(ns_to_ktime)
+
static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
const enum hrtimer_mode mode)
{