[PATCH 1/6] backports: add ktime_get_raw()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/ktime.h | 12 ++++++++++++
 backport/compat/backport-3.17.c         | 12 ++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 backport/backport-include/linux/ktime.h

diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h
new file mode 100644
index 0000000..adefc27
--- /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 9cc0a82..567f0c3 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);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux