summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-08-09 13:42:40 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2014-08-09 16:40:30 +0200
commit7b62a86c4fe3c758f5de15dbc11a55e73812724e (patch)
tree5f28bbced2b6e46ebe12d127462050f590faf3e3
parent2cc1500fe79718fad2362b75b01d36e4e6bbd0c8 (diff)
backports: add ktime_get_raw()
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/ktime.h12
-rw-r--r--backport/compat/backport-3.17.c12
2 files changed, 24 insertions, 0 deletions
diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h
new file mode 100644
index 00000000..adefc270
--- /dev/null
+++ b/backport/backport-include/linux/ktime.h
@@ -0,0 +1,12 @@
+#ifndef __BACKPORT_LINUX_KTIME_H
+#define __BACKPORT_LINUX_KTIME_H
+#include_next <linux/ktime.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+#define ktime_get_raw LINUX_BACKPORT(ktime_get_raw)
+extern ktime_t ktime_get_raw(void);
+
+#endif /* < 3.17 */
+
+#endif /* __BACKPORT_LINUX_KTIME_H */
diff --git a/backport/compat/backport-3.17.c b/backport/compat/backport-3.17.c
index 9cc0a82f..567f0c3b 100644
--- a/backport/compat/backport-3.17.c
+++ b/backport/compat/backport-3.17.c
@@ -10,6 +10,7 @@
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/export.h>
+#include <linux/ktime.h>
int bit_wait(void *word)
{
@@ -25,3 +26,14 @@ int bit_wait_io(void *word)
}
EXPORT_SYMBOL_GPL(bit_wait_io);
+/**
+ * ktime_get_raw - Returns the raw monotonic time in ktime_t format
+ */
+ktime_t ktime_get_raw(void)
+{
+ struct timespec ts;
+
+ getrawmonotonic(&ts);
+ return timespec_to_ktime(ts);
+}
+EXPORT_SYMBOL_GPL(ktime_get_raw);