From: Hauke Mehrtens Date: Sat, 9 Aug 2014 11:42:40 +0000 (+0200) Subject: backports: add ktime_get_raw() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7b62a86c4fe3c758f5de15dbc11a55e73812724e;p=openwrt%2Fstaging%2Fblogic.git backports: add ktime_get_raw() Signed-off-by: Hauke Mehrtens --- diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h new file mode 100644 index 000000000000..adefc270fd02 --- /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 +#include + +#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 9cc0a82fe6e0..567f0c3bd674 100644 --- a/backport/compat/backport-3.17.c +++ b/backport/compat/backport-3.17.c @@ -10,6 +10,7 @@ #include #include #include +#include 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);