From 8468250328b607cbd2774c2209fbe5826be01098 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 28 Mar 2019 21:54:24 -0500 Subject: [PATCH] dahdi: define dahdi_ktime_equal() Older kernels (2.6.32) are unable to do a direct comparison of ktime values, while kernels post 4.10 have removed the comparison function. Therefore we need to make our own compatibility interface for comparing the ktime values. Signed-off-by: Shaun Ruffell --- include/dahdi/kernel.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 58f3af4..2236f6d 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1414,6 +1414,9 @@ timer_setup(struct timer_list *timer, #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) #define refcount_read atomic_read +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#define dahdi_ktime_equal ktime_equal + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) #ifdef RHEL_RELEASE_VERSION @@ -1477,6 +1480,7 @@ static inline void *PDE_DATA(const struct inode *inode) #endif /* 3.10.0 */ #endif /* 3.16.0 */ #endif /* 4.0.0 */ +#endif /* 4.10.0 */ #endif /* 4.11.0 */ #endif /* 4.13.0 */ #else /* >= 4.15.0 */ @@ -1487,6 +1491,13 @@ static inline void *PDE_DATA(const struct inode *inode) #endif /* 4.15.0 */ +#ifndef dahdi_ktime_equal +static inline int dahdi_ktime_equal(const ktime_t cmp1, const ktime_t cmp2) +{ + return cmp1 == cmp2; +} +#endif + #ifndef DEFINE_SPINLOCK #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED #endif