Skip to contentSkip to conversation

backports: provide backport for ktime_get_seconds()

PATCH In review Arend van Spriel 1 participant 2 messages Oct 16, 2015 – Oct 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: provide backport for ktime_get_seconds()

Since commit 84b00607aeb8 ("mac80211: use ktime_get_seconds") mac80211 uses ktime_get_seconds(). This patch provide a backport using ktime_get_ts() for it.

---
 backport/backport-include/linux/ktime.h |  8 ++++++++
 backport/compat/backport-4.3.c          | 10 ++++++++++
 2 files changed, 18 insertions(+)
backport/backport-include/linux/ktime.h +8 -0
index 6fbc6c6..2edacf9 100644
@@ -9,6 +9,14 @@ extern ktime_t ktime_get_raw(void);
 
 #endif /* < 3.17 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+typedef __s64 time64_t;
+#endif
+#define ktime_get_seconds LINUX_BACKPORT(ktime_get_seconds)
+extern time64_t ktime_get_seconds(void);
+#endif /* < 3.19 */
+
 #ifndef ktime_to_timespec64
 /* Map the ktime_t to timespec conversion to ns_to_timespec function */
 #define ktime_to_timespec64(kt)		ns_to_timespec64((kt).tv64)
backport/compat/backport-4.3.c +10 -0
index d15c92c..2797944 100644
@@ -11,6 +11,7 @@
 #include <linux/seq_file.h>
 #include <linux/export.h>
 #include <linux/printk.h>
+#include <linux/ktime.h>
 
 static void seq_set_overflow(struct seq_file *m)
 {
@@ -57,3 +58,12 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
 	}
 }
 EXPORT_SYMBOL_GPL(seq_hex_dump);
+
+time64_t ktime_get_seconds(void)
+{
+	struct timespec ts;
+
+	ktime_get_ts(&ts);
+	return ts.tv_sec;
+}
+EXPORT_SYMBOL_GPL(ktime_get_seconds);
Signature · 4 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#1 lore raw
Quoted 3 lines · Arend van Spriel

Since commit 84b00607aeb8 ("mac80211: use ktime_get_seconds") mac80211 uses ktime_get_seconds(). This patch provide a backport using ktime_get_ts() for it.

That commit probably is for 4.4 kernel so guess it needs to be in a newly created backport-4.4.c, right?

Regards,
Arend

Quoted 41 lines
---
  backport/backport-include/linux/ktime.h |  8 ++++++++
  backport/compat/backport-4.3.c          | 10 ++++++++++
  2 files changed, 18 insertions(+)
backport/backport-include/linux/ktime.h +8 -0
index 6fbc6c6..2edacf9 100644
@@ -9,6 +9,14 @@ extern ktime_t ktime_get_raw(void);
 
  #endif /* < 3.17 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
+typedef __s64 time64_t;
+#endif
+#define ktime_get_seconds LINUX_BACKPORT(ktime_get_seconds)
+extern time64_t ktime_get_seconds(void);
+#endif /* < 3.19 */
+
  #ifndef ktime_to_timespec64
  /* Map the ktime_t to timespec conversion to ns_to_timespec function */
  #define ktime_to_timespec64(kt)		ns_to_timespec64((kt).tv64)
backport/compat/backport-4.3.c +1 -0
index d15c92c..2797944 100644
@@ -11,6 +11,7 @@
  #include <linux/seq_file.h>
  #include <linux/export.h>
  #include <linux/printk.h>
+#include <linux/ktime.h>
 
  static void seq_set_overflow(struct seq_file *m)
  {
@@ -57,3 +58,12 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
  	}
  }

backport/compat/backport-4.3.c void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type, · line 69

Quoted 10 lines
backport/compat/backport-4.3.c +9 -0
  EXPORT_SYMBOL_GPL(seq_hex_dump);
+
+time64_t ktime_get_seconds(void)
+{
+	struct timespec ts;
+
+	ktime_get_ts(&ts);
+	return ts.tv_sec;
+}
+EXPORT_SYMBOL_GPL(ktime_get_seconds);

--
To unsubscribe from this list: send the line "unsubscribe backports" in