Fix: kref changes for kernel 4.11
[lttng-modules.git] / wrapper / kref.h
index f30a9aed515db306a1803ff5e4bcc2612a75801b..3f3be7a42d27c0445d7273fc771b5d55dd120248 100644 (file)
 
 #include <linux/kref.h>
 #include <linux/rculist.h>
+#include <linux/version.h>
 
 /*
  * lttng_kref_get: get reference count, checking for overflow.
  *
  * Return 1 if reference is taken, 0 otherwise (overflow).
  */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+static inline int lttng_kref_get(struct kref *kref)
+{
+       kref_get(kref);
+       return 1;
+}
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
 static inline int lttng_kref_get(struct kref *kref)
 {
        return atomic_add_unless(&kref->refcount, 1, INT_MAX);
 }
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
 
 #endif /* _LTTNG_WRAPPER_KREF_H */
This page took 0.024682 seconds and 4 git commands to generate.