diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2016-11-14 11:29:48 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-01-14 05:37:18 -0500 |
| commit | 2c935bc57221cc2edc787c72ea0e2d30cdcd3d5e (patch) | |
| tree | 4ccb975ac9142887b4e7e7bf1c0cca5c53d4cf99 /include/net/bluetooth | |
| parent | 1e24edca0557dba6486d39d3c24c288475432bcf (diff) | |
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>
Diffstat (limited to 'include/net/bluetooth')
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 554671c81f4a..90708f68cc02 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -987,7 +987,7 @@ static inline void hci_conn_drop(struct hci_conn *conn) | |||
| 987 | static inline void hci_dev_put(struct hci_dev *d) | 987 | static inline void hci_dev_put(struct hci_dev *d) |
| 988 | { | 988 | { |
| 989 | BT_DBG("%s orig refcnt %d", d->name, | 989 | BT_DBG("%s orig refcnt %d", d->name, |
| 990 | atomic_read(&d->dev.kobj.kref.refcount)); | 990 | kref_read(&d->dev.kobj.kref)); |
| 991 | 991 | ||
| 992 | put_device(&d->dev); | 992 | put_device(&d->dev); |
| 993 | } | 993 | } |
| @@ -995,7 +995,7 @@ static inline void hci_dev_put(struct hci_dev *d) | |||
| 995 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) | 995 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) |
| 996 | { | 996 | { |
| 997 | BT_DBG("%s orig refcnt %d", d->name, | 997 | BT_DBG("%s orig refcnt %d", d->name, |
| 998 | atomic_read(&d->dev.kobj.kref.refcount)); | 998 | kref_read(&d->dev.kobj.kref)); |
| 999 | 999 | ||
| 1000 | get_device(&d->dev); | 1000 | get_device(&d->dev); |
| 1001 | return d; | 1001 | return d; |
