locking/atomic, kref: Add kref_read()
Since we need to change the implementation, stop exposing internals. Provide kref_read() to read the current reference count; typically used for debug messages. Kills two anti-patterns: atomic_read(&kref->refcount) kref->refcount.counter 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>
This commit is contained in:
committed by
Ingo Molnar
parent
1e24edca05
commit
2c935bc572
@@ -155,7 +155,7 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
|
||||
pnv_php_detach_device_nodes(dn);
|
||||
|
||||
of_node_put(dn);
|
||||
refcount = atomic_read(&dn->kobj.kref.refcount);
|
||||
refcount = kref_read(&dn->kobj.kref);
|
||||
if (refcount != 1)
|
||||
pr_warn("Invalid refcount %d on <%s>\n",
|
||||
refcount, of_node_full_name(dn));
|
||||
|
||||
Reference in New Issue
Block a user