Commit 4541b8cd authored by Mathis MARION's avatar Mathis MARION Committed by Federico Vaga

Kernel 5.6 compatibility for timespec

`struct timespec` is no longer available from headers after kernel 5.6.
It is now required to use `struct timespec64`, which uses a 64bit
integer for seconds instead of the former 32bit.

The function `timespec_to_ktime` becomes `timespec64_to_ktime`

The function `getnstimeofday` becomes `ktime_get_real_ts64`
Signed-off-by: 's avatarGwenhael GOAVEC <gwenhael.goavec@femto-st.fr>
Signed-off-by: 's avatarMathis MARION <mathis.marion@grenoble-inp.org>
parent 30948899
......@@ -34,8 +34,13 @@ static enum hrtimer_restart zdtc_fn(struct hrtimer *timer)
struct timespec ts;
getnstimeofday(&ts);
#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE
dev_dbg(&zdtc.cset->head.dev, "%s: %9lli.%09li\n", __func__,
ts.tv_sec, ts.tv_nsec);
#else
dev_dbg(&zdtc.cset->head.dev, "%s: %9li.%09li\n", __func__,
ts.tv_sec, ts.tv_nsec);
#endif
zio_trigger_data_done(zdtc.cset);
return HRTIMER_NORESTART;
}
......
......@@ -23,9 +23,16 @@ extern const uint32_t zio_version;
#include <linux/list.h>
#include <linux/string.h>
#include <linux/spinlock.h>
#include <linux/version.h>
#include <linux/zio-sysfs.h>
#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE
#define timespec timespec64
#define timespec_to_ktime(__z) timespec64_to_ktime(__z)
#define getnstimeofday(__z) ktime_get_real_ts64(__z)
#endif
#define ZIO_NR_MINORS (1<<16) /* Ask for 64k minors: no harm done... */
/* Name the data structures */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment