summaryrefslogtreecommitdiff
path: root/backport-include/linux/kref.h
diff options
context:
space:
mode:
Diffstat (limited to 'backport-include/linux/kref.h')
-rw-r--r--backport-include/linux/kref.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/backport-include/linux/kref.h b/backport-include/linux/kref.h
new file mode 100644
index 0000000..631488f
--- /dev/null
+++ b/backport-include/linux/kref.h
@@ -0,0 +1,13 @@
+#ifndef __BACKPORT_LINUX_KREF_H
+#define __BACKPORT_LINUX_KREF_H
+#include_next <linux/kref.h>
+
+#if LINUX_VERSION_IS_LESS(4,11,0)
+#include <linux/refcount.h>
+static inline unsigned int kref_read(const struct kref *kref)
+{
+ return refcount_read((const refcount_t *)&kref->refcount);
+}
+#endif /* < 4.11 */
+
+#endif /* __BACKPORT_LINUX_KREF_H */