summaryrefslogtreecommitdiff
path: root/include/linux/kref.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-11-14 19:12:23 +0300
committerIngo Molnar <mingo@kernel.org>2017-01-14 13:37:18 +0300
commit1e24edca0557dba6486d39d3c24c288475432bcf (patch)
tree9ee0931fdfa80b2b2b809bd26ad2aced7c8bce33 /include/linux/kref.h
parent2b0b211134a65401ed874ce0d5d48844f4f6f341 (diff)
downloadlinux-1e24edca0557dba6486d39d3c24c288475432bcf.tar.xz
locking/atomic, kref: Add KREF_INIT()
Since we need to change the implementation, stop exposing internals. Provide KREF_INIT() to allow static initialization of struct kref. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/kref.h')
-rw-r--r--include/linux/kref.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/kref.h b/include/linux/kref.h
index e15828fd71f1..9af255ad1e2f 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -24,6 +24,8 @@ struct kref {
atomic_t refcount;
};
+#define KREF_INIT(n) { .refcount = ATOMIC_INIT(n), }
+
/**
* kref_init - initialize object.
* @kref: object in question.