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 | |
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>
56 files changed, 121 insertions, 117 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index de279fe4e4fd..74306c054983 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -520,7 +520,7 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m, | |||
520 | /* Completion does it's own kref_put. If we are going to | 520 | /* Completion does it's own kref_put. If we are going to |
521 | * kref_sub below, we need req to be still around then. */ | 521 | * kref_sub below, we need req to be still around then. */ |
522 | int at_least = k_put + !!c_put; | 522 | int at_least = k_put + !!c_put; |
523 | int refcount = atomic_read(&req->kref.refcount); | 523 | int refcount = kref_read(&req->kref); |
524 | if (refcount < at_least) | 524 | if (refcount < at_least) |
525 | drbd_err(device, | 525 | drbd_err(device, |
526 | "mod_rq_state: Logic BUG: %x -> %x: refcount = %d, should be >= %d\n", | 526 | "mod_rq_state: Logic BUG: %x -> %x: refcount = %d, should be >= %d\n", |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 36d2b9f4e836..436baa66f701 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1535,7 +1535,7 @@ static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request) | |||
1535 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) | 1535 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) |
1536 | { | 1536 | { |
1537 | dout("%s: obj %p (was %d)\n", __func__, obj_request, | 1537 | dout("%s: obj %p (was %d)\n", __func__, obj_request, |
1538 | atomic_read(&obj_request->kref.refcount)); | 1538 | kref_read(&obj_request->kref)); |
1539 | kref_get(&obj_request->kref); | 1539 | kref_get(&obj_request->kref); |
1540 | } | 1540 | } |
1541 | 1541 | ||
@@ -1544,14 +1544,14 @@ static void rbd_obj_request_put(struct rbd_obj_request *obj_request) | |||
1544 | { | 1544 | { |
1545 | rbd_assert(obj_request != NULL); | 1545 | rbd_assert(obj_request != NULL); |
1546 | dout("%s: obj %p (was %d)\n", __func__, obj_request, | 1546 | dout("%s: obj %p (was %d)\n", __func__, obj_request, |
1547 | atomic_read(&obj_request->kref.refcount)); | 1547 | kref_read(&obj_request->kref)); |
1548 | kref_put(&obj_request->kref, rbd_obj_request_destroy); | 1548 | kref_put(&obj_request->kref, rbd_obj_request_destroy); |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | static void rbd_img_request_get(struct rbd_img_request *img_request) | 1551 | static void rbd_img_request_get(struct rbd_img_request *img_request) |
1552 | { | 1552 | { |
1553 | dout("%s: img %p (was %d)\n", __func__, img_request, | 1553 | dout("%s: img %p (was %d)\n", __func__, img_request, |
1554 | atomic_read(&img_request->kref.refcount)); | 1554 | kref_read(&img_request->kref)); |
1555 | kref_get(&img_request->kref); | 1555 | kref_get(&img_request->kref); |
1556 | } | 1556 | } |
1557 | 1557 | ||
@@ -1562,7 +1562,7 @@ static void rbd_img_request_put(struct rbd_img_request *img_request) | |||
1562 | { | 1562 | { |
1563 | rbd_assert(img_request != NULL); | 1563 | rbd_assert(img_request != NULL); |
1564 | dout("%s: img %p (was %d)\n", __func__, img_request, | 1564 | dout("%s: img %p (was %d)\n", __func__, img_request, |
1565 | atomic_read(&img_request->kref.refcount)); | 1565 | kref_read(&img_request->kref)); |
1566 | if (img_request_child_test(img_request)) | 1566 | if (img_request_child_test(img_request)) |
1567 | kref_put(&img_request->kref, rbd_parent_request_destroy); | 1567 | kref_put(&img_request->kref, rbd_parent_request_destroy); |
1568 | else | 1568 | else |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 5545a679abd8..79a346c97446 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -767,7 +767,7 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
767 | /* Stop all the virtqueues. */ | 767 | /* Stop all the virtqueues. */ |
768 | vdev->config->reset(vdev); | 768 | vdev->config->reset(vdev); |
769 | 769 | ||
770 | refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount); | 770 | refc = kref_read(&disk_to_dev(vblk->disk)->kobj.kref); |
771 | put_disk(vblk->disk); | 771 | put_disk(vblk->disk); |
772 | vdev->config->del_vqs(vdev); | 772 | vdev->config->del_vqs(vdev); |
773 | kfree(vblk->vqs); | 773 | kfree(vblk->vqs); |
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 1d6c335584ec..33cd51632721 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c | |||
@@ -376,7 +376,7 @@ void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, | |||
376 | off = drm_vma_node_start(&obj->vma_node); | 376 | off = drm_vma_node_start(&obj->vma_node); |
377 | 377 | ||
378 | seq_printf(m, "%2d (%2d) %08llx %pad %p %zu", | 378 | seq_printf(m, "%2d (%2d) %08llx %pad %p %zu", |
379 | obj->name, obj->refcount.refcount.counter, | 379 | obj->name, kref_read(&obj->refcount), |
380 | off, &cma_obj->paddr, cma_obj->vaddr, obj->size); | 380 | off, &cma_obj->paddr, cma_obj->vaddr, obj->size); |
381 | 381 | ||
382 | seq_printf(m, "\n"); | 382 | seq_printf(m, "\n"); |
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index ffb2ab389d1d..6b68e9088436 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -118,7 +118,7 @@ static int drm_gem_one_name_info(int id, void *ptr, void *data) | |||
118 | seq_printf(m, "%6d %8zd %7d %8d\n", | 118 | seq_printf(m, "%6d %8zd %7d %8d\n", |
119 | obj->name, obj->size, | 119 | obj->name, obj->size, |
120 | obj->handle_count, | 120 | obj->handle_count, |
121 | atomic_read(&obj->refcount.refcount)); | 121 | kref_read(&obj->refcount)); |
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index 9f17085b1fdd..c6885a4911c0 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c | |||
@@ -159,7 +159,7 @@ EXPORT_SYMBOL(drm_mode_object_find); | |||
159 | void drm_mode_object_unreference(struct drm_mode_object *obj) | 159 | void drm_mode_object_unreference(struct drm_mode_object *obj) |
160 | { | 160 | { |
161 | if (obj->free_cb) { | 161 | if (obj->free_cb) { |
162 | DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, atomic_read(&obj->refcount.refcount)); | 162 | DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); |
163 | kref_put(&obj->refcount, obj->free_cb); | 163 | kref_put(&obj->refcount, obj->free_cb); |
164 | } | 164 | } |
165 | } | 165 | } |
@@ -176,7 +176,7 @@ EXPORT_SYMBOL(drm_mode_object_unreference); | |||
176 | void drm_mode_object_reference(struct drm_mode_object *obj) | 176 | void drm_mode_object_reference(struct drm_mode_object *obj) |
177 | { | 177 | { |
178 | if (obj->free_cb) { | 178 | if (obj->free_cb) { |
179 | DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, atomic_read(&obj->refcount.refcount)); | 179 | DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); |
180 | kref_get(&obj->refcount); | 180 | kref_get(&obj->refcount); |
181 | } | 181 | } |
182 | } | 182 | } |
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c index 114dddbd297b..aa6e35ddc87f 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c | |||
@@ -486,7 +486,7 @@ static void etnaviv_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | |||
486 | 486 | ||
487 | seq_printf(m, "%08x: %c %2d (%2d) %08lx %p %zd\n", | 487 | seq_printf(m, "%08x: %c %2d (%2d) %08lx %p %zd\n", |
488 | etnaviv_obj->flags, is_active(etnaviv_obj) ? 'A' : 'I', | 488 | etnaviv_obj->flags, is_active(etnaviv_obj) ? 'A' : 'I', |
489 | obj->name, obj->refcount.refcount.counter, | 489 | obj->name, kref_read(&obj->refcount), |
490 | off, etnaviv_obj->vaddr, obj->size); | 490 | off, etnaviv_obj->vaddr, obj->size); |
491 | 491 | ||
492 | rcu_read_lock(); | 492 | rcu_read_lock(); |
diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h index 6a368de9d81e..ecfefb9d42e4 100644 --- a/drivers/gpu/drm/i915/i915_gem_object.h +++ b/drivers/gpu/drm/i915/i915_gem_object.h | |||
@@ -256,7 +256,7 @@ extern void drm_gem_object_unreference_unlocked(struct drm_gem_object *); | |||
256 | static inline bool | 256 | static inline bool |
257 | i915_gem_object_is_dead(const struct drm_i915_gem_object *obj) | 257 | i915_gem_object_is_dead(const struct drm_i915_gem_object *obj) |
258 | { | 258 | { |
259 | return atomic_read(&obj->base.refcount.refcount) == 0; | 259 | return kref_read(&obj->base.refcount) == 0; |
260 | } | 260 | } |
261 | 261 | ||
262 | static inline bool | 262 | static inline bool |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index d8bc59c7e261..4d24d9389036 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
@@ -640,7 +640,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | |||
640 | 640 | ||
641 | seq_printf(m, "%08x: %c %2d (%2d) %08llx %p\t", | 641 | seq_printf(m, "%08x: %c %2d (%2d) %08llx %p\t", |
642 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', | 642 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', |
643 | obj->name, obj->refcount.refcount.counter, | 643 | obj->name, kref_read(&obj->refcount), |
644 | off, msm_obj->vaddr); | 644 | off, msm_obj->vaddr); |
645 | 645 | ||
646 | for (id = 0; id < priv->num_aspaces; id++) | 646 | for (id = 0; id < priv->num_aspaces; id++) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index a6126c93f215..88ee60d1b907 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -527,7 +527,7 @@ static bool nouveau_fence_no_signaling(struct dma_fence *f) | |||
527 | * caller should have a reference on the fence, | 527 | * caller should have a reference on the fence, |
528 | * else fence could get freed here | 528 | * else fence could get freed here |
529 | */ | 529 | */ |
530 | WARN_ON(atomic_read(&fence->base.refcount.refcount) <= 1); | 530 | WARN_ON(kref_read(&fence->base.refcount) <= 1); |
531 | 531 | ||
532 | /* | 532 | /* |
533 | * This needs uevents to work correctly, but dma_fence_add_callback relies on | 533 | * This needs uevents to work correctly, but dma_fence_add_callback relies on |
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 4a90c690f09e..74a9968df421 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c | |||
@@ -1033,7 +1033,7 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | |||
1033 | off = drm_vma_node_start(&obj->vma_node); | 1033 | off = drm_vma_node_start(&obj->vma_node); |
1034 | 1034 | ||
1035 | seq_printf(m, "%08x: %2d (%2d) %08llx %pad (%2d) %p %4d", | 1035 | seq_printf(m, "%08x: %2d (%2d) %08llx %pad (%2d) %p %4d", |
1036 | omap_obj->flags, obj->name, obj->refcount.refcount.counter, | 1036 | omap_obj->flags, obj->name, kref_read(&obj->refcount), |
1037 | off, &omap_obj->paddr, omap_obj->paddr_cnt, | 1037 | off, &omap_obj->paddr, omap_obj->paddr_cnt, |
1038 | omap_obj->vaddr, omap_obj->roll); | 1038 | omap_obj->vaddr, omap_obj->roll); |
1039 | 1039 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index d5063618efa7..30aefcc0c969 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -140,8 +140,8 @@ static void ttm_bo_release_list(struct kref *list_kref) | |||
140 | struct ttm_bo_device *bdev = bo->bdev; | 140 | struct ttm_bo_device *bdev = bo->bdev; |
141 | size_t acc_size = bo->acc_size; | 141 | size_t acc_size = bo->acc_size; |
142 | 142 | ||
143 | BUG_ON(atomic_read(&bo->list_kref.refcount)); | 143 | BUG_ON(kref_read(&bo->list_kref)); |
144 | BUG_ON(atomic_read(&bo->kref.refcount)); | 144 | BUG_ON(kref_read(&bo->kref)); |
145 | BUG_ON(atomic_read(&bo->cpu_writers)); | 145 | BUG_ON(atomic_read(&bo->cpu_writers)); |
146 | BUG_ON(bo->mem.mm_node != NULL); | 146 | BUG_ON(bo->mem.mm_node != NULL); |
147 | BUG_ON(!list_empty(&bo->lru)); | 147 | BUG_ON(!list_empty(&bo->lru)); |
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index 4f5fa8d65fe9..fdb451e3ec01 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c | |||
@@ -304,7 +304,7 @@ bool ttm_ref_object_exists(struct ttm_object_file *tfile, | |||
304 | * Verify that the ref->obj pointer was actually valid! | 304 | * Verify that the ref->obj pointer was actually valid! |
305 | */ | 305 | */ |
306 | rmb(); | 306 | rmb(); |
307 | if (unlikely(atomic_read(&ref->kref.refcount) == 0)) | 307 | if (unlikely(kref_read(&ref->kref) == 0)) |
308 | goto out_false; | 308 | goto out_false; |
309 | 309 | ||
310 | rcu_read_unlock(); | 310 | rcu_read_unlock(); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.h b/drivers/infiniband/hw/cxgb3/iwch_cm.h index b9efadfffb4f..e66e75921797 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.h +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.h | |||
@@ -55,14 +55,14 @@ | |||
55 | 55 | ||
56 | #define put_ep(ep) { \ | 56 | #define put_ep(ep) { \ |
57 | PDBG("put_ep (via %s:%u) ep %p refcnt %d\n", __func__, __LINE__, \ | 57 | PDBG("put_ep (via %s:%u) ep %p refcnt %d\n", __func__, __LINE__, \ |
58 | ep, atomic_read(&((ep)->kref.refcount))); \ | 58 | ep, kref_read(&((ep)->kref))); \ |
59 | WARN_ON(atomic_read(&((ep)->kref.refcount)) < 1); \ | 59 | WARN_ON(kref_read(&((ep)->kref)) < 1); \ |
60 | kref_put(&((ep)->kref), __free_ep); \ | 60 | kref_put(&((ep)->kref), __free_ep); \ |
61 | } | 61 | } |
62 | 62 | ||
63 | #define get_ep(ep) { \ | 63 | #define get_ep(ep) { \ |
64 | PDBG("get_ep (via %s:%u) ep %p, refcnt %d\n", __func__, __LINE__, \ | 64 | PDBG("get_ep (via %s:%u) ep %p, refcnt %d\n", __func__, __LINE__, \ |
65 | ep, atomic_read(&((ep)->kref.refcount))); \ | 65 | ep, kref_read(&((ep)->kref))); \ |
66 | kref_get(&((ep)->kref)); \ | 66 | kref_get(&((ep)->kref)); \ |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index d939980a708f..a9194db7f9b8 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -961,7 +961,7 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp, | |||
961 | case IWCH_QP_STATE_RTS: | 961 | case IWCH_QP_STATE_RTS: |
962 | switch (attrs->next_state) { | 962 | switch (attrs->next_state) { |
963 | case IWCH_QP_STATE_CLOSING: | 963 | case IWCH_QP_STATE_CLOSING: |
964 | BUG_ON(atomic_read(&qhp->ep->com.kref.refcount) < 2); | 964 | BUG_ON(kref_read(&qhp->ep->com.kref) < 2); |
965 | qhp->attr.state = IWCH_QP_STATE_CLOSING; | 965 | qhp->attr.state = IWCH_QP_STATE_CLOSING; |
966 | if (!internal) { | 966 | if (!internal) { |
967 | abort=0; | 967 | abort=0; |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 4788e1a46fde..4dc141596e57 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -654,14 +654,14 @@ enum c4iw_mmid_state { | |||
654 | 654 | ||
655 | #define c4iw_put_ep(ep) { \ | 655 | #define c4iw_put_ep(ep) { \ |
656 | PDBG("put_ep (via %s:%u) ep %p refcnt %d\n", __func__, __LINE__, \ | 656 | PDBG("put_ep (via %s:%u) ep %p refcnt %d\n", __func__, __LINE__, \ |
657 | ep, atomic_read(&((ep)->kref.refcount))); \ | 657 | ep, kref_read(&((ep)->kref))); \ |
658 | WARN_ON(atomic_read(&((ep)->kref.refcount)) < 1); \ | 658 | WARN_ON(kref_read(&((ep)->kref)) < 1); \ |
659 | kref_put(&((ep)->kref), _c4iw_free_ep); \ | 659 | kref_put(&((ep)->kref), _c4iw_free_ep); \ |
660 | } | 660 | } |
661 | 661 | ||
662 | #define c4iw_get_ep(ep) { \ | 662 | #define c4iw_get_ep(ep) { \ |
663 | PDBG("get_ep (via %s:%u) ep %p, refcnt %d\n", __func__, __LINE__, \ | 663 | PDBG("get_ep (via %s:%u) ep %p, refcnt %d\n", __func__, __LINE__, \ |
664 | ep, atomic_read(&((ep)->kref.refcount))); \ | 664 | ep, kref_read(&((ep)->kref))); \ |
665 | kref_get(&((ep)->kref)); \ | 665 | kref_get(&((ep)->kref)); \ |
666 | } | 666 | } |
667 | void _c4iw_free_ep(struct kref *kref); | 667 | void _c4iw_free_ep(struct kref *kref); |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index cda5542e13a2..347b3c93ffd7 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -1503,7 +1503,7 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1503 | case C4IW_QP_STATE_RTS: | 1503 | case C4IW_QP_STATE_RTS: |
1504 | switch (attrs->next_state) { | 1504 | switch (attrs->next_state) { |
1505 | case C4IW_QP_STATE_CLOSING: | 1505 | case C4IW_QP_STATE_CLOSING: |
1506 | BUG_ON(atomic_read(&qhp->ep->com.kref.refcount) < 2); | 1506 | BUG_ON(kref_read(&qhp->ep->com.kref) < 2); |
1507 | t4_set_wq_in_error(&qhp->wq); | 1507 | t4_set_wq_in_error(&qhp->wq); |
1508 | set_state(qhp, C4IW_QP_STATE_CLOSING); | 1508 | set_state(qhp, C4IW_QP_STATE_CLOSING); |
1509 | ep = qhp->ep; | 1509 | ep = qhp->ep; |
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c index 80ef3f8998c8..04443242e258 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c | |||
@@ -80,7 +80,7 @@ usnic_ib_show_config(struct device *device, struct device_attribute *attr, | |||
80 | left = PAGE_SIZE; | 80 | left = PAGE_SIZE; |
81 | 81 | ||
82 | mutex_lock(&us_ibdev->usdev_lock); | 82 | mutex_lock(&us_ibdev->usdev_lock); |
83 | if (atomic_read(&us_ibdev->vf_cnt.refcount) > 0) { | 83 | if (kref_read(&us_ibdev->vf_cnt) > 0) { |
84 | char *busname; | 84 | char *busname; |
85 | 85 | ||
86 | /* | 86 | /* |
@@ -99,7 +99,7 @@ usnic_ib_show_config(struct device *device, struct device_attribute *attr, | |||
99 | PCI_FUNC(us_ibdev->pdev->devfn), | 99 | PCI_FUNC(us_ibdev->pdev->devfn), |
100 | netdev_name(us_ibdev->netdev), | 100 | netdev_name(us_ibdev->netdev), |
101 | us_ibdev->ufdev->mac, | 101 | us_ibdev->ufdev->mac, |
102 | atomic_read(&us_ibdev->vf_cnt.refcount)); | 102 | kref_read(&us_ibdev->vf_cnt)); |
103 | UPDATE_PTR_LEFT(n, ptr, left); | 103 | UPDATE_PTR_LEFT(n, ptr, left); |
104 | 104 | ||
105 | for (res_type = USNIC_VNIC_RES_TYPE_EOL; | 105 | for (res_type = USNIC_VNIC_RES_TYPE_EOL; |
@@ -147,7 +147,7 @@ usnic_ib_show_max_vf(struct device *device, struct device_attribute *attr, | |||
147 | us_ibdev = container_of(device, struct usnic_ib_dev, ib_dev.dev); | 147 | us_ibdev = container_of(device, struct usnic_ib_dev, ib_dev.dev); |
148 | 148 | ||
149 | return scnprintf(buf, PAGE_SIZE, "%u\n", | 149 | return scnprintf(buf, PAGE_SIZE, "%u\n", |
150 | atomic_read(&us_ibdev->vf_cnt.refcount)); | 150 | kref_read(&us_ibdev->vf_cnt)); |
151 | } | 151 | } |
152 | 152 | ||
153 | static ssize_t | 153 | static ssize_t |
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index 74819a7951e2..69df8e353123 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c | |||
@@ -291,11 +291,11 @@ int usnic_ib_query_device(struct ib_device *ibdev, | |||
291 | qp_per_vf = max(us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_WQ], | 291 | qp_per_vf = max(us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_WQ], |
292 | us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_RQ]); | 292 | us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_RQ]); |
293 | props->max_qp = qp_per_vf * | 293 | props->max_qp = qp_per_vf * |
294 | atomic_read(&us_ibdev->vf_cnt.refcount); | 294 | kref_read(&us_ibdev->vf_cnt); |
295 | props->device_cap_flags = IB_DEVICE_PORT_ACTIVE_EVENT | | 295 | props->device_cap_flags = IB_DEVICE_PORT_ACTIVE_EVENT | |
296 | IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_BLOCK_MULTICAST_LOOPBACK; | 296 | IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_BLOCK_MULTICAST_LOOPBACK; |
297 | props->max_cq = us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_CQ] * | 297 | props->max_cq = us_ibdev->vf_res_cnt[USNIC_VNIC_RES_TYPE_CQ] * |
298 | atomic_read(&us_ibdev->vf_cnt.refcount); | 298 | kref_read(&us_ibdev->vf_cnt); |
299 | props->max_pd = USNIC_UIOM_MAX_PD_CNT; | 299 | props->max_pd = USNIC_UIOM_MAX_PD_CNT; |
300 | props->max_mr = USNIC_UIOM_MAX_MR_CNT; | 300 | props->max_mr = USNIC_UIOM_MAX_MR_CNT; |
301 | props->local_ca_ack_delay = 0; | 301 | props->local_ca_ack_delay = 0; |
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 7f1b282d7d96..cb290b8ca0c8 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c | |||
@@ -1396,7 +1396,7 @@ int genwqe_device_remove(struct genwqe_dev *cd) | |||
1396 | * application which will decrease this reference from | 1396 | * application which will decrease this reference from |
1397 | * 1/unused to 0/illegal and not from 2/used 1/empty. | 1397 | * 1/unused to 0/illegal and not from 2/used 1/empty. |
1398 | */ | 1398 | */ |
1399 | rc = atomic_read(&cd->cdev_genwqe.kobj.kref.refcount); | 1399 | rc = kref_read(&cd->cdev_genwqe.kobj.kref); |
1400 | if (rc != 1) { | 1400 | if (rc != 1) { |
1401 | dev_err(&pci_dev->dev, | 1401 | dev_err(&pci_dev->dev, |
1402 | "[%s] err: cdev_genwqe...refcount=%d\n", __func__, rc); | 1402 | "[%s] err: cdev_genwqe...refcount=%d\n", __func__, rc); |
diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c index c6c051b52f55..e32a92341b54 100644 --- a/drivers/misc/mei/debugfs.c +++ b/drivers/misc/mei/debugfs.c | |||
@@ -67,7 +67,7 @@ static ssize_t mei_dbgfs_read_meclients(struct file *fp, char __user *ubuf, | |||
67 | me_cl->props.max_number_of_connections, | 67 | me_cl->props.max_number_of_connections, |
68 | me_cl->props.max_msg_length, | 68 | me_cl->props.max_msg_length, |
69 | me_cl->props.single_recv_buf, | 69 | me_cl->props.single_recv_buf, |
70 | atomic_read(&me_cl->refcnt.refcount)); | 70 | kref_read(&me_cl->refcnt)); |
71 | 71 | ||
72 | mei_me_cl_put(me_cl); | 72 | mei_me_cl_put(me_cl); |
73 | } | 73 | } |
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 56efaf72d08e..d2961ef39a3a 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c | |||
@@ -155,7 +155,7 @@ static void pnv_php_detach_device_nodes(struct device_node *parent) | |||
155 | pnv_php_detach_device_nodes(dn); | 155 | pnv_php_detach_device_nodes(dn); |
156 | 156 | ||
157 | of_node_put(dn); | 157 | of_node_put(dn); |
158 | refcount = atomic_read(&dn->kobj.kref.refcount); | 158 | refcount = kref_read(&dn->kobj.kref); |
159 | if (refcount != 1) | 159 | if (refcount != 1) |
160 | pr_warn("Invalid refcount %d on <%s>\n", | 160 | pr_warn("Invalid refcount %d on <%s>\n", |
161 | refcount, of_node_full_name(dn)); | 161 | refcount, of_node_full_name(dn)); |
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index 429d34c348b9..e42909524dee 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(pci_create_slot); | |||
345 | void pci_destroy_slot(struct pci_slot *slot) | 345 | void pci_destroy_slot(struct pci_slot *slot) |
346 | { | 346 | { |
347 | dev_dbg(&slot->bus->dev, "dev %02x, dec refcount to %d\n", | 347 | dev_dbg(&slot->bus->dev, "dev %02x, dec refcount to %d\n", |
348 | slot->number, atomic_read(&slot->kobj.kref.refcount) - 1); | 348 | slot->number, kref_read(&slot->kobj.kref) - 1); |
349 | 349 | ||
350 | mutex_lock(&pci_slot_mutex); | 350 | mutex_lock(&pci_slot_mutex); |
351 | kobject_put(&slot->kobj); | 351 | kobject_put(&slot->kobj); |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index f501095f91ac..898461b146cc 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -74,7 +74,7 @@ static void bnx2fc_cmd_timeout(struct work_struct *work) | |||
74 | &io_req->req_flags)) { | 74 | &io_req->req_flags)) { |
75 | /* Handle internally generated ABTS timeout */ | 75 | /* Handle internally generated ABTS timeout */ |
76 | BNX2FC_IO_DBG(io_req, "ABTS timed out refcnt = %d\n", | 76 | BNX2FC_IO_DBG(io_req, "ABTS timed out refcnt = %d\n", |
77 | io_req->refcount.refcount.counter); | 77 | kref_read(&io_req->refcount)); |
78 | if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, | 78 | if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, |
79 | &io_req->req_flags))) { | 79 | &io_req->req_flags))) { |
80 | /* | 80 | /* |
@@ -1141,7 +1141,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd) | |||
1141 | return SUCCESS; | 1141 | return SUCCESS; |
1142 | } | 1142 | } |
1143 | BNX2FC_IO_DBG(io_req, "eh_abort - refcnt = %d\n", | 1143 | BNX2FC_IO_DBG(io_req, "eh_abort - refcnt = %d\n", |
1144 | io_req->refcount.refcount.counter); | 1144 | kref_read(&io_req->refcount)); |
1145 | 1145 | ||
1146 | /* Hold IO request across abort processing */ | 1146 | /* Hold IO request across abort processing */ |
1147 | kref_get(&io_req->refcount); | 1147 | kref_get(&io_req->refcount); |
@@ -1299,7 +1299,7 @@ void bnx2fc_process_cleanup_compl(struct bnx2fc_cmd *io_req, | |||
1299 | { | 1299 | { |
1300 | BNX2FC_IO_DBG(io_req, "Entered process_cleanup_compl " | 1300 | BNX2FC_IO_DBG(io_req, "Entered process_cleanup_compl " |
1301 | "refcnt = %d, cmd_type = %d\n", | 1301 | "refcnt = %d, cmd_type = %d\n", |
1302 | io_req->refcount.refcount.counter, io_req->cmd_type); | 1302 | kref_read(&io_req->refcount), io_req->cmd_type); |
1303 | bnx2fc_scsi_done(io_req, DID_ERROR); | 1303 | bnx2fc_scsi_done(io_req, DID_ERROR); |
1304 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 1304 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
1305 | if (io_req->wait_for_comp) | 1305 | if (io_req->wait_for_comp) |
@@ -1318,7 +1318,7 @@ void bnx2fc_process_abts_compl(struct bnx2fc_cmd *io_req, | |||
1318 | BNX2FC_IO_DBG(io_req, "Entered process_abts_compl xid = 0x%x" | 1318 | BNX2FC_IO_DBG(io_req, "Entered process_abts_compl xid = 0x%x" |
1319 | "refcnt = %d, cmd_type = %d\n", | 1319 | "refcnt = %d, cmd_type = %d\n", |
1320 | io_req->xid, | 1320 | io_req->xid, |
1321 | io_req->refcount.refcount.counter, io_req->cmd_type); | 1321 | kref_read(&io_req->refcount), io_req->cmd_type); |
1322 | 1322 | ||
1323 | if (test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, | 1323 | if (test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, |
1324 | &io_req->req_flags)) { | 1324 | &io_req->req_flags)) { |
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 95ba99044c3e..18e0ea83d361 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h | |||
@@ -301,7 +301,7 @@ static inline void __cxgbi_sock_put(const char *fn, struct cxgbi_sock *csk) | |||
301 | { | 301 | { |
302 | log_debug(1 << CXGBI_DBG_SOCK, | 302 | log_debug(1 << CXGBI_DBG_SOCK, |
303 | "%s, put csk 0x%p, ref %u-1.\n", | 303 | "%s, put csk 0x%p, ref %u-1.\n", |
304 | fn, csk, atomic_read(&csk->refcnt.refcount)); | 304 | fn, csk, kref_read(&csk->refcnt)); |
305 | kref_put(&csk->refcnt, cxgbi_sock_free); | 305 | kref_put(&csk->refcnt, cxgbi_sock_free); |
306 | } | 306 | } |
307 | #define cxgbi_sock_put(csk) __cxgbi_sock_put(__func__, csk) | 307 | #define cxgbi_sock_put(csk) __cxgbi_sock_put(__func__, csk) |
@@ -310,7 +310,7 @@ static inline void __cxgbi_sock_get(const char *fn, struct cxgbi_sock *csk) | |||
310 | { | 310 | { |
311 | log_debug(1 << CXGBI_DBG_SOCK, | 311 | log_debug(1 << CXGBI_DBG_SOCK, |
312 | "%s, get csk 0x%p, ref %u+1.\n", | 312 | "%s, get csk 0x%p, ref %u+1.\n", |
313 | fn, csk, atomic_read(&csk->refcnt.refcount)); | 313 | fn, csk, kref_read(&csk->refcnt)); |
314 | kref_get(&csk->refcnt); | 314 | kref_get(&csk->refcnt); |
315 | } | 315 | } |
316 | #define cxgbi_sock_get(csk) __cxgbi_sock_get(__func__, csk) | 316 | #define cxgbi_sock_get(csk) __cxgbi_sock_get(__func__, csk) |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index a63542bac153..caa7a7b0ec53 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -607,7 +607,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | |||
607 | len += snprintf(buf+len, size-len, "usgmap:%x ", | 607 | len += snprintf(buf+len, size-len, "usgmap:%x ", |
608 | ndlp->nlp_usg_map); | 608 | ndlp->nlp_usg_map); |
609 | len += snprintf(buf+len, size-len, "refcnt:%x", | 609 | len += snprintf(buf+len, size-len, "refcnt:%x", |
610 | atomic_read(&ndlp->kref.refcount)); | 610 | kref_read(&ndlp->kref)); |
611 | len += snprintf(buf+len, size-len, "\n"); | 611 | len += snprintf(buf+len, size-len, "\n"); |
612 | } | 612 | } |
613 | spin_unlock_irq(shost->host_lock); | 613 | spin_unlock_irq(shost->host_lock); |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 236e4e51d161..7a8829546068 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -3688,7 +3688,7 @@ lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3688 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, | 3688 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, |
3689 | "0006 rpi%x DID:%x flg:%x %d map:%x %p\n", | 3689 | "0006 rpi%x DID:%x flg:%x %d map:%x %p\n", |
3690 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, | 3690 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, |
3691 | atomic_read(&ndlp->kref.refcount), | 3691 | kref_read(&ndlp->kref), |
3692 | ndlp->nlp_usg_map, ndlp); | 3692 | ndlp->nlp_usg_map, ndlp); |
3693 | if (NLP_CHK_NODE_ACT(ndlp)) { | 3693 | if (NLP_CHK_NODE_ACT(ndlp)) { |
3694 | lpfc_nlp_put(ndlp); | 3694 | lpfc_nlp_put(ndlp); |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index ed223937798a..82047070cdc9 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -3440,7 +3440,7 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3440 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, | 3440 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, |
3441 | "0002 rpi:%x DID:%x flg:%x %d map:%x %p\n", | 3441 | "0002 rpi:%x DID:%x flg:%x %d map:%x %p\n", |
3442 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, | 3442 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, |
3443 | atomic_read(&ndlp->kref.refcount), | 3443 | kref_read(&ndlp->kref), |
3444 | ndlp->nlp_usg_map, ndlp); | 3444 | ndlp->nlp_usg_map, ndlp); |
3445 | if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) | 3445 | if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) |
3446 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; | 3446 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; |
@@ -3861,7 +3861,7 @@ out: | |||
3861 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, | 3861 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, |
3862 | "0003 rpi:%x DID:%x flg:%x %d map%x %p\n", | 3862 | "0003 rpi:%x DID:%x flg:%x %d map%x %p\n", |
3863 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, | 3863 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, |
3864 | atomic_read(&ndlp->kref.refcount), | 3864 | kref_read(&ndlp->kref), |
3865 | ndlp->nlp_usg_map, ndlp); | 3865 | ndlp->nlp_usg_map, ndlp); |
3866 | 3866 | ||
3867 | if (vport->port_state < LPFC_VPORT_READY) { | 3867 | if (vport->port_state < LPFC_VPORT_READY) { |
@@ -4238,7 +4238,7 @@ lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
4238 | "0277 lpfc_enable_node: ndlp:x%p " | 4238 | "0277 lpfc_enable_node: ndlp:x%p " |
4239 | "usgmap:x%x refcnt:%d\n", | 4239 | "usgmap:x%x refcnt:%d\n", |
4240 | (void *)ndlp, ndlp->nlp_usg_map, | 4240 | (void *)ndlp, ndlp->nlp_usg_map, |
4241 | atomic_read(&ndlp->kref.refcount)); | 4241 | kref_read(&ndlp->kref)); |
4242 | return NULL; | 4242 | return NULL; |
4243 | } | 4243 | } |
4244 | /* The ndlp should not already be in active mode */ | 4244 | /* The ndlp should not already be in active mode */ |
@@ -4248,7 +4248,7 @@ lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
4248 | "0278 lpfc_enable_node: ndlp:x%p " | 4248 | "0278 lpfc_enable_node: ndlp:x%p " |
4249 | "usgmap:x%x refcnt:%d\n", | 4249 | "usgmap:x%x refcnt:%d\n", |
4250 | (void *)ndlp, ndlp->nlp_usg_map, | 4250 | (void *)ndlp, ndlp->nlp_usg_map, |
4251 | atomic_read(&ndlp->kref.refcount)); | 4251 | kref_read(&ndlp->kref)); |
4252 | return NULL; | 4252 | return NULL; |
4253 | } | 4253 | } |
4254 | 4254 | ||
@@ -4272,7 +4272,7 @@ lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
4272 | "0008 rpi:%x DID:%x flg:%x refcnt:%d " | 4272 | "0008 rpi:%x DID:%x flg:%x refcnt:%d " |
4273 | "map:%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID, | 4273 | "map:%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID, |
4274 | ndlp->nlp_flag, | 4274 | ndlp->nlp_flag, |
4275 | atomic_read(&ndlp->kref.refcount), | 4275 | kref_read(&ndlp->kref), |
4276 | ndlp->nlp_usg_map, ndlp); | 4276 | ndlp->nlp_usg_map, ndlp); |
4277 | } | 4277 | } |
4278 | 4278 | ||
@@ -4546,7 +4546,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4546 | (bf_get(lpfc_sli_intf_if_type, | 4546 | (bf_get(lpfc_sli_intf_if_type, |
4547 | &phba->sli4_hba.sli_intf) == | 4547 | &phba->sli4_hba.sli_intf) == |
4548 | LPFC_SLI_INTF_IF_TYPE_2) && | 4548 | LPFC_SLI_INTF_IF_TYPE_2) && |
4549 | (atomic_read(&ndlp->kref.refcount) > 0)) { | 4549 | (kref_read(&ndlp->kref) > 0)) { |
4550 | mbox->context1 = lpfc_nlp_get(ndlp); | 4550 | mbox->context1 = lpfc_nlp_get(ndlp); |
4551 | mbox->mbox_cmpl = | 4551 | mbox->mbox_cmpl = |
4552 | lpfc_sli4_unreg_rpi_cmpl_clr; | 4552 | lpfc_sli4_unreg_rpi_cmpl_clr; |
@@ -4695,14 +4695,14 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4695 | "0280 lpfc_cleanup_node: ndlp:x%p " | 4695 | "0280 lpfc_cleanup_node: ndlp:x%p " |
4696 | "usgmap:x%x refcnt:%d\n", | 4696 | "usgmap:x%x refcnt:%d\n", |
4697 | (void *)ndlp, ndlp->nlp_usg_map, | 4697 | (void *)ndlp, ndlp->nlp_usg_map, |
4698 | atomic_read(&ndlp->kref.refcount)); | 4698 | kref_read(&ndlp->kref)); |
4699 | lpfc_dequeue_node(vport, ndlp); | 4699 | lpfc_dequeue_node(vport, ndlp); |
4700 | } else { | 4700 | } else { |
4701 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE, | 4701 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE, |
4702 | "0281 lpfc_cleanup_node: ndlp:x%p " | 4702 | "0281 lpfc_cleanup_node: ndlp:x%p " |
4703 | "usgmap:x%x refcnt:%d\n", | 4703 | "usgmap:x%x refcnt:%d\n", |
4704 | (void *)ndlp, ndlp->nlp_usg_map, | 4704 | (void *)ndlp, ndlp->nlp_usg_map, |
4705 | atomic_read(&ndlp->kref.refcount)); | 4705 | kref_read(&ndlp->kref)); |
4706 | lpfc_disable_node(vport, ndlp); | 4706 | lpfc_disable_node(vport, ndlp); |
4707 | } | 4707 | } |
4708 | 4708 | ||
@@ -4791,7 +4791,7 @@ lpfc_nlp_remove(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4791 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, | 4791 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
4792 | "0005 rpi:%x DID:%x flg:%x %d map:%x %p\n", | 4792 | "0005 rpi:%x DID:%x flg:%x %d map:%x %p\n", |
4793 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, | 4793 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, |
4794 | atomic_read(&ndlp->kref.refcount), | 4794 | kref_read(&ndlp->kref), |
4795 | ndlp->nlp_usg_map, ndlp); | 4795 | ndlp->nlp_usg_map, ndlp); |
4796 | if ((mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL)) | 4796 | if ((mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL)) |
4797 | != NULL) { | 4797 | != NULL) { |
@@ -5557,7 +5557,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
5557 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, | 5557 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, |
5558 | "0004 rpi:%x DID:%x flg:%x %d map:%x %p\n", | 5558 | "0004 rpi:%x DID:%x flg:%x %d map:%x %p\n", |
5559 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, | 5559 | ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, |
5560 | atomic_read(&ndlp->kref.refcount), | 5560 | kref_read(&ndlp->kref), |
5561 | ndlp->nlp_usg_map, ndlp); | 5561 | ndlp->nlp_usg_map, ndlp); |
5562 | /* | 5562 | /* |
5563 | * Start issuing Fabric-Device Management Interface (FDMI) command to | 5563 | * Start issuing Fabric-Device Management Interface (FDMI) command to |
@@ -5728,7 +5728,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
5728 | "0007 rpi:%x DID:%x flg:%x refcnt:%d " | 5728 | "0007 rpi:%x DID:%x flg:%x refcnt:%d " |
5729 | "map:%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID, | 5729 | "map:%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID, |
5730 | ndlp->nlp_flag, | 5730 | ndlp->nlp_flag, |
5731 | atomic_read(&ndlp->kref.refcount), | 5731 | kref_read(&ndlp->kref), |
5732 | ndlp->nlp_usg_map, ndlp); | 5732 | ndlp->nlp_usg_map, ndlp); |
5733 | 5733 | ||
5734 | ndlp->active_rrqs_xri_bitmap = | 5734 | ndlp->active_rrqs_xri_bitmap = |
@@ -5767,7 +5767,7 @@ lpfc_nlp_release(struct kref *kref) | |||
5767 | "0279 lpfc_nlp_release: ndlp:x%p did %x " | 5767 | "0279 lpfc_nlp_release: ndlp:x%p did %x " |
5768 | "usgmap:x%x refcnt:%d rpi:%x\n", | 5768 | "usgmap:x%x refcnt:%d rpi:%x\n", |
5769 | (void *)ndlp, ndlp->nlp_DID, ndlp->nlp_usg_map, | 5769 | (void *)ndlp, ndlp->nlp_DID, ndlp->nlp_usg_map, |
5770 | atomic_read(&ndlp->kref.refcount), ndlp->nlp_rpi); | 5770 | kref_read(&ndlp->kref), ndlp->nlp_rpi); |
5771 | 5771 | ||
5772 | /* remove ndlp from action. */ | 5772 | /* remove ndlp from action. */ |
5773 | lpfc_nlp_remove(ndlp->vport, ndlp); | 5773 | lpfc_nlp_remove(ndlp->vport, ndlp); |
@@ -5804,7 +5804,7 @@ lpfc_nlp_get(struct lpfc_nodelist *ndlp) | |||
5804 | lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, | 5804 | lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, |
5805 | "node get: did:x%x flg:x%x refcnt:x%x", | 5805 | "node get: did:x%x flg:x%x refcnt:x%x", |
5806 | ndlp->nlp_DID, ndlp->nlp_flag, | 5806 | ndlp->nlp_DID, ndlp->nlp_flag, |
5807 | atomic_read(&ndlp->kref.refcount)); | 5807 | kref_read(&ndlp->kref)); |
5808 | /* The check of ndlp usage to prevent incrementing the | 5808 | /* The check of ndlp usage to prevent incrementing the |
5809 | * ndlp reference count that is in the process of being | 5809 | * ndlp reference count that is in the process of being |
5810 | * released. | 5810 | * released. |
@@ -5817,7 +5817,7 @@ lpfc_nlp_get(struct lpfc_nodelist *ndlp) | |||
5817 | "0276 lpfc_nlp_get: ndlp:x%p " | 5817 | "0276 lpfc_nlp_get: ndlp:x%p " |
5818 | "usgmap:x%x refcnt:%d\n", | 5818 | "usgmap:x%x refcnt:%d\n", |
5819 | (void *)ndlp, ndlp->nlp_usg_map, | 5819 | (void *)ndlp, ndlp->nlp_usg_map, |
5820 | atomic_read(&ndlp->kref.refcount)); | 5820 | kref_read(&ndlp->kref)); |
5821 | return NULL; | 5821 | return NULL; |
5822 | } else | 5822 | } else |
5823 | kref_get(&ndlp->kref); | 5823 | kref_get(&ndlp->kref); |
@@ -5844,7 +5844,7 @@ lpfc_nlp_put(struct lpfc_nodelist *ndlp) | |||
5844 | lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, | 5844 | lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, |
5845 | "node put: did:x%x flg:x%x refcnt:x%x", | 5845 | "node put: did:x%x flg:x%x refcnt:x%x", |
5846 | ndlp->nlp_DID, ndlp->nlp_flag, | 5846 | ndlp->nlp_DID, ndlp->nlp_flag, |
5847 | atomic_read(&ndlp->kref.refcount)); | 5847 | kref_read(&ndlp->kref)); |
5848 | phba = ndlp->phba; | 5848 | phba = ndlp->phba; |
5849 | spin_lock_irqsave(&phba->ndlp_lock, flags); | 5849 | spin_lock_irqsave(&phba->ndlp_lock, flags); |
5850 | /* Check the ndlp memory free acknowledge flag to avoid the | 5850 | /* Check the ndlp memory free acknowledge flag to avoid the |
@@ -5857,7 +5857,7 @@ lpfc_nlp_put(struct lpfc_nodelist *ndlp) | |||
5857 | "0274 lpfc_nlp_put: ndlp:x%p " | 5857 | "0274 lpfc_nlp_put: ndlp:x%p " |
5858 | "usgmap:x%x refcnt:%d\n", | 5858 | "usgmap:x%x refcnt:%d\n", |
5859 | (void *)ndlp, ndlp->nlp_usg_map, | 5859 | (void *)ndlp, ndlp->nlp_usg_map, |
5860 | atomic_read(&ndlp->kref.refcount)); | 5860 | kref_read(&ndlp->kref)); |
5861 | return 1; | 5861 | return 1; |
5862 | } | 5862 | } |
5863 | /* Check the ndlp inactivate log flag to avoid the possible | 5863 | /* Check the ndlp inactivate log flag to avoid the possible |
@@ -5870,7 +5870,7 @@ lpfc_nlp_put(struct lpfc_nodelist *ndlp) | |||
5870 | "0275 lpfc_nlp_put: ndlp:x%p " | 5870 | "0275 lpfc_nlp_put: ndlp:x%p " |
5871 | "usgmap:x%x refcnt:%d\n", | 5871 | "usgmap:x%x refcnt:%d\n", |
5872 | (void *)ndlp, ndlp->nlp_usg_map, | 5872 | (void *)ndlp, ndlp->nlp_usg_map, |
5873 | atomic_read(&ndlp->kref.refcount)); | 5873 | kref_read(&ndlp->kref)); |
5874 | return 1; | 5874 | return 1; |
5875 | } | 5875 | } |
5876 | /* For last put, mark the ndlp usage flags to make sure no | 5876 | /* For last put, mark the ndlp usage flags to make sure no |
@@ -5878,7 +5878,7 @@ lpfc_nlp_put(struct lpfc_nodelist *ndlp) | |||
5878 | * in between the process when the final kref_put has been | 5878 | * in between the process when the final kref_put has been |
5879 | * invoked on this ndlp. | 5879 | * invoked on this ndlp. |
5880 | */ | 5880 | */ |
5881 | if (atomic_read(&ndlp->kref.refcount) == 1) { | 5881 | if (kref_read(&ndlp->kref) == 1) { |
5882 | /* Indicate ndlp is put to inactive state. */ | 5882 | /* Indicate ndlp is put to inactive state. */ |
5883 | NLP_SET_IACT_REQ(ndlp); | 5883 | NLP_SET_IACT_REQ(ndlp); |
5884 | /* Acknowledge ndlp memory free has been seen. */ | 5884 | /* Acknowledge ndlp memory free has been seen. */ |
@@ -5906,8 +5906,8 @@ lpfc_nlp_not_used(struct lpfc_nodelist *ndlp) | |||
5906 | lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, | 5906 | lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, |
5907 | "node not used: did:x%x flg:x%x refcnt:x%x", | 5907 | "node not used: did:x%x flg:x%x refcnt:x%x", |
5908 | ndlp->nlp_DID, ndlp->nlp_flag, | 5908 | ndlp->nlp_DID, ndlp->nlp_flag, |
5909 | atomic_read(&ndlp->kref.refcount)); | 5909 | kref_read(&ndlp->kref)); |
5910 | if (atomic_read(&ndlp->kref.refcount) == 1) | 5910 | if (kref_read(&ndlp->kref) == 1) |
5911 | if (lpfc_nlp_put(ndlp)) | 5911 | if (lpfc_nlp_put(ndlp)) |
5912 | return 1; | 5912 | return 1; |
5913 | return 0; | 5913 | return 0; |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 4776fd85514f..64717c171b15 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -2660,8 +2660,7 @@ lpfc_cleanup(struct lpfc_vport *vport) | |||
2660 | "usgmap:x%x refcnt:%d\n", | 2660 | "usgmap:x%x refcnt:%d\n", |
2661 | ndlp->nlp_DID, (void *)ndlp, | 2661 | ndlp->nlp_DID, (void *)ndlp, |
2662 | ndlp->nlp_usg_map, | 2662 | ndlp->nlp_usg_map, |
2663 | atomic_read( | 2663 | kref_read(&ndlp->kref)); |
2664 | &ndlp->kref.refcount)); | ||
2665 | } | 2664 | } |
2666 | break; | 2665 | break; |
2667 | } | 2666 | } |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 6643f6fc7795..dd28c69b6a92 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -371,7 +371,7 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) | |||
371 | */ | 371 | */ |
372 | pr_debug("write_pending aborted cmd[%p] refcount %d " | 372 | pr_debug("write_pending aborted cmd[%p] refcount %d " |
373 | "transport_state %x, t_state %x, se_cmd_flags %x\n", | 373 | "transport_state %x, t_state %x, se_cmd_flags %x\n", |
374 | cmd,cmd->se_cmd.cmd_kref.refcount.counter, | 374 | cmd, kref_read(&cmd->se_cmd.cmd_kref), |
375 | cmd->se_cmd.transport_state, | 375 | cmd->se_cmd.transport_state, |
376 | cmd->se_cmd.t_state, | 376 | cmd->se_cmd.t_state, |
377 | cmd->se_cmd.se_cmd_flags); | 377 | cmd->se_cmd.se_cmd_flags); |
@@ -584,7 +584,7 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) | |||
584 | */ | 584 | */ |
585 | pr_debug("queue_data_in aborted cmd[%p] refcount %d " | 585 | pr_debug("queue_data_in aborted cmd[%p] refcount %d " |
586 | "transport_state %x, t_state %x, se_cmd_flags %x\n", | 586 | "transport_state %x, t_state %x, se_cmd_flags %x\n", |
587 | cmd,cmd->se_cmd.cmd_kref.refcount.counter, | 587 | cmd, kref_read(&cmd->se_cmd.cmd_kref), |
588 | cmd->se_cmd.transport_state, | 588 | cmd->se_cmd.transport_state, |
589 | cmd->se_cmd.t_state, | 589 | cmd->se_cmd.t_state, |
590 | cmd->se_cmd.se_cmd_flags); | 590 | cmd->se_cmd.se_cmd_flags); |
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index b653451843c8..937c2d5d7ec3 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c | |||
@@ -1300,7 +1300,7 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) | |||
1300 | seq_printf(s, "%16s %16u %16zu %d %d\n", | 1300 | seq_printf(s, "%16s %16u %16zu %d %d\n", |
1301 | buffer->task_comm, buffer->pid, | 1301 | buffer->task_comm, buffer->pid, |
1302 | buffer->size, buffer->kmap_cnt, | 1302 | buffer->size, buffer->kmap_cnt, |
1303 | atomic_read(&buffer->ref.refcount)); | 1303 | kref_read(&buffer->ref)); |
1304 | total_orphaned_size += buffer->size; | 1304 | total_orphaned_size += buffer->size; |
1305 | } | 1305 | } |
1306 | } | 1306 | } |
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index c7d7682b1412..1e1df89b5018 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c | |||
@@ -188,7 +188,7 @@ bool comedi_buf_is_mmapped(struct comedi_subdevice *s) | |||
188 | { | 188 | { |
189 | struct comedi_buf_map *bm = s->async->buf_map; | 189 | struct comedi_buf_map *bm = s->async->buf_map; |
190 | 190 | ||
191 | return bm && (atomic_read(&bm->refcount.refcount) > 1); | 191 | return bm && (kref_read(&bm->refcount) > 1); |
192 | } | 192 | } |
193 | 193 | ||
194 | int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, | 194 | int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index d761025144f9..e18051185846 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -788,7 +788,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( | |||
788 | * __core_scsi3_add_registration() | 788 | * __core_scsi3_add_registration() |
789 | */ | 789 | */ |
790 | dest_lun = rcu_dereference_check(deve_tmp->se_lun, | 790 | dest_lun = rcu_dereference_check(deve_tmp->se_lun, |
791 | atomic_read(&deve_tmp->pr_kref.refcount) != 0); | 791 | kref_read(&deve_tmp->pr_kref) != 0); |
792 | 792 | ||
793 | pr_reg_atp = __core_scsi3_do_alloc_registration(dev, | 793 | pr_reg_atp = __core_scsi3_do_alloc_registration(dev, |
794 | nacl_tmp, dest_lun, deve_tmp, | 794 | nacl_tmp, dest_lun, deve_tmp, |
@@ -1463,7 +1463,7 @@ static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve) | |||
1463 | * For nacl->dynamic_node_acl=1 | 1463 | * For nacl->dynamic_node_acl=1 |
1464 | */ | 1464 | */ |
1465 | lun_acl = rcu_dereference_check(se_deve->se_lun_acl, | 1465 | lun_acl = rcu_dereference_check(se_deve->se_lun_acl, |
1466 | atomic_read(&se_deve->pr_kref.refcount) != 0); | 1466 | kref_read(&se_deve->pr_kref) != 0); |
1467 | if (!lun_acl) | 1467 | if (!lun_acl) |
1468 | return 0; | 1468 | return 0; |
1469 | 1469 | ||
@@ -1478,7 +1478,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | |||
1478 | * For nacl->dynamic_node_acl=1 | 1478 | * For nacl->dynamic_node_acl=1 |
1479 | */ | 1479 | */ |
1480 | lun_acl = rcu_dereference_check(se_deve->se_lun_acl, | 1480 | lun_acl = rcu_dereference_check(se_deve->se_lun_acl, |
1481 | atomic_read(&se_deve->pr_kref.refcount) != 0); | 1481 | kref_read(&se_deve->pr_kref) != 0); |
1482 | if (!lun_acl) { | 1482 | if (!lun_acl) { |
1483 | kref_put(&se_deve->pr_kref, target_pr_kref_release); | 1483 | kref_put(&se_deve->pr_kref, target_pr_kref_release); |
1484 | return; | 1484 | return; |
@@ -1759,7 +1759,7 @@ core_scsi3_decode_spec_i_port( | |||
1759 | * 2nd loop which will never fail. | 1759 | * 2nd loop which will never fail. |
1760 | */ | 1760 | */ |
1761 | dest_lun = rcu_dereference_check(dest_se_deve->se_lun, | 1761 | dest_lun = rcu_dereference_check(dest_se_deve->se_lun, |
1762 | atomic_read(&dest_se_deve->pr_kref.refcount) != 0); | 1762 | kref_read(&dest_se_deve->pr_kref) != 0); |
1763 | 1763 | ||
1764 | dest_pr_reg = __core_scsi3_alloc_registration(cmd->se_dev, | 1764 | dest_pr_reg = __core_scsi3_alloc_registration(cmd->se_dev, |
1765 | dest_node_acl, dest_lun, dest_se_deve, | 1765 | dest_node_acl, dest_lun, dest_se_deve, |
@@ -3466,7 +3466,7 @@ after_iport_check: | |||
3466 | iport_ptr); | 3466 | iport_ptr); |
3467 | if (!dest_pr_reg) { | 3467 | if (!dest_pr_reg) { |
3468 | struct se_lun *dest_lun = rcu_dereference_check(dest_se_deve->se_lun, | 3468 | struct se_lun *dest_lun = rcu_dereference_check(dest_se_deve->se_lun, |
3469 | atomic_read(&dest_se_deve->pr_kref.refcount) != 0); | 3469 | kref_read(&dest_se_deve->pr_kref) != 0); |
3470 | 3470 | ||
3471 | spin_unlock(&dev->dev_reservation_lock); | 3471 | spin_unlock(&dev->dev_reservation_lock); |
3472 | if (core_scsi3_alloc_registration(cmd->se_dev, dest_node_acl, | 3472 | if (core_scsi3_alloc_registration(cmd->se_dev, dest_node_acl, |
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index fd5c3de79470..c91979c1463d 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c | |||
@@ -454,7 +454,7 @@ static void ft_sess_free(struct kref *kref) | |||
454 | 454 | ||
455 | void ft_sess_put(struct ft_sess *sess) | 455 | void ft_sess_put(struct ft_sess *sess) |
456 | { | 456 | { |
457 | int sess_held = atomic_read(&sess->kref.refcount); | 457 | int sess_held = kref_read(&sess->kref); |
458 | 458 | ||
459 | BUG_ON(!sess_held); | 459 | BUG_ON(!sess_held); |
460 | kref_put(&sess->kref, ft_sess_free); | 460 | kref_put(&sess->kref, ft_sess_free); |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 5e746adc8a2d..365443cae5b1 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -3687,7 +3687,7 @@ static void ffs_closed(struct ffs_data *ffs) | |||
3687 | goto done; | 3687 | goto done; |
3688 | 3688 | ||
3689 | if (opts->no_configfs || !opts->func_inst.group.cg_item.ci_parent | 3689 | if (opts->no_configfs || !opts->func_inst.group.cg_item.ci_parent |
3690 | || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount)) | 3690 | || !kref_read(&opts->func_inst.group.cg_item.ci_kref)) |
3691 | goto done; | 3691 | goto done; |
3692 | 3692 | ||
3693 | ci = opts->func_inst.group.cg_item.ci_parent->ci_parent; | 3693 | ci = opts->func_inst.group.cg_item.ci_parent->ci_parent; |
diff --git a/fs/exofs/sys.c b/fs/exofs/sys.c index 5e6a2c0a1f0b..1f7d5e46cdda 100644 --- a/fs/exofs/sys.c +++ b/fs/exofs/sys.c | |||
@@ -122,7 +122,7 @@ void exofs_sysfs_dbg_print(void) | |||
122 | list_for_each_entry_safe(k_name, k_tmp, &exofs_kset->list, entry) { | 122 | list_for_each_entry_safe(k_name, k_tmp, &exofs_kset->list, entry) { |
123 | printk(KERN_INFO "%s: name %s ref %d\n", | 123 | printk(KERN_INFO "%s: name %s ref %d\n", |
124 | __func__, kobject_name(k_name), | 124 | __func__, kobject_name(k_name), |
125 | (int)atomic_read(&k_name->kref.refcount)); | 125 | (int)kref_read(&k_name->kref)); |
126 | } | 126 | } |
127 | #endif | 127 | #endif |
128 | } | 128 | } |
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index 27d1242c8383..564c504d6efd 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
@@ -349,7 +349,7 @@ static void sc_show_sock_container(struct seq_file *seq, | |||
349 | " func key: 0x%08x\n" | 349 | " func key: 0x%08x\n" |
350 | " func type: %u\n", | 350 | " func type: %u\n", |
351 | sc, | 351 | sc, |
352 | atomic_read(&sc->sc_kref.refcount), | 352 | kref_read(&sc->sc_kref), |
353 | &saddr, inet ? ntohs(sport) : 0, | 353 | &saddr, inet ? ntohs(sport) : 0, |
354 | &daddr, inet ? ntohs(dport) : 0, | 354 | &daddr, inet ? ntohs(dport) : 0, |
355 | sc->sc_node->nd_name, | 355 | sc->sc_node->nd_name, |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index d4b5c81f0445..ec000575e863 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -97,7 +97,7 @@ | |||
97 | typeof(sc) __sc = (sc); \ | 97 | typeof(sc) __sc = (sc); \ |
98 | mlog(ML_SOCKET, "[sc %p refs %d sock %p node %u page %p " \ | 98 | mlog(ML_SOCKET, "[sc %p refs %d sock %p node %u page %p " \ |
99 | "pg_off %zu] " fmt, __sc, \ | 99 | "pg_off %zu] " fmt, __sc, \ |
100 | atomic_read(&__sc->sc_kref.refcount), __sc->sc_sock, \ | 100 | kref_read(&__sc->sc_kref), __sc->sc_sock, \ |
101 | __sc->sc_node->nd_num, __sc->sc_page, __sc->sc_page_off , \ | 101 | __sc->sc_node->nd_num, __sc->sc_page, __sc->sc_page_off , \ |
102 | ##args); \ | 102 | ##args); \ |
103 | } while (0) | 103 | } while (0) |
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index e7b760deefae..9b984cae4c4e 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c | |||
@@ -81,7 +81,7 @@ static void __dlm_print_lock(struct dlm_lock *lock) | |||
81 | lock->ml.type, lock->ml.convert_type, lock->ml.node, | 81 | lock->ml.type, lock->ml.convert_type, lock->ml.node, |
82 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | 82 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), |
83 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), | 83 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), |
84 | atomic_read(&lock->lock_refs.refcount), | 84 | kref_read(&lock->lock_refs), |
85 | (list_empty(&lock->ast_list) ? 'y' : 'n'), | 85 | (list_empty(&lock->ast_list) ? 'y' : 'n'), |
86 | (lock->ast_pending ? 'y' : 'n'), | 86 | (lock->ast_pending ? 'y' : 'n'), |
87 | (list_empty(&lock->bast_list) ? 'y' : 'n'), | 87 | (list_empty(&lock->bast_list) ? 'y' : 'n'), |
@@ -106,7 +106,7 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res) | |||
106 | printk("lockres: %s, owner=%u, state=%u\n", | 106 | printk("lockres: %s, owner=%u, state=%u\n", |
107 | buf, res->owner, res->state); | 107 | buf, res->owner, res->state); |
108 | printk(" last used: %lu, refcnt: %u, on purge list: %s\n", | 108 | printk(" last used: %lu, refcnt: %u, on purge list: %s\n", |
109 | res->last_used, atomic_read(&res->refs.refcount), | 109 | res->last_used, kref_read(&res->refs), |
110 | list_empty(&res->purge) ? "no" : "yes"); | 110 | list_empty(&res->purge) ? "no" : "yes"); |
111 | printk(" on dirty list: %s, on reco list: %s, " | 111 | printk(" on dirty list: %s, on reco list: %s, " |
112 | "migrating pending: %s\n", | 112 | "migrating pending: %s\n", |
@@ -298,7 +298,7 @@ static int dump_mle(struct dlm_master_list_entry *mle, char *buf, int len) | |||
298 | mle_type, mle->master, mle->new_master, | 298 | mle_type, mle->master, mle->new_master, |
299 | !list_empty(&mle->hb_events), | 299 | !list_empty(&mle->hb_events), |
300 | !!mle->inuse, | 300 | !!mle->inuse, |
301 | atomic_read(&mle->mle_refs.refcount)); | 301 | kref_read(&mle->mle_refs)); |
302 | 302 | ||
303 | out += snprintf(buf + out, len - out, "Maybe="); | 303 | out += snprintf(buf + out, len - out, "Maybe="); |
304 | out += stringify_nodemap(mle->maybe_map, O2NM_MAX_NODES, | 304 | out += stringify_nodemap(mle->maybe_map, O2NM_MAX_NODES, |
@@ -494,7 +494,7 @@ static int dump_lock(struct dlm_lock *lock, int list_type, char *buf, int len) | |||
494 | lock->ast_pending, lock->bast_pending, | 494 | lock->ast_pending, lock->bast_pending, |
495 | lock->convert_pending, lock->lock_pending, | 495 | lock->convert_pending, lock->lock_pending, |
496 | lock->cancel_pending, lock->unlock_pending, | 496 | lock->cancel_pending, lock->unlock_pending, |
497 | atomic_read(&lock->lock_refs.refcount)); | 497 | kref_read(&lock->lock_refs)); |
498 | spin_unlock(&lock->spinlock); | 498 | spin_unlock(&lock->spinlock); |
499 | 499 | ||
500 | return out; | 500 | return out; |
@@ -521,7 +521,7 @@ static int dump_lockres(struct dlm_lock_resource *res, char *buf, int len) | |||
521 | !list_empty(&res->recovering), | 521 | !list_empty(&res->recovering), |
522 | res->inflight_locks, res->migration_pending, | 522 | res->inflight_locks, res->migration_pending, |
523 | atomic_read(&res->asts_reserved), | 523 | atomic_read(&res->asts_reserved), |
524 | atomic_read(&res->refs.refcount)); | 524 | kref_read(&res->refs)); |
525 | 525 | ||
526 | /* refmap */ | 526 | /* refmap */ |
527 | out += snprintf(buf + out, len - out, "RMAP:"); | 527 | out += snprintf(buf + out, len - out, "RMAP:"); |
@@ -777,7 +777,7 @@ static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) | |||
777 | /* Purge Count: xxx Refs: xxx */ | 777 | /* Purge Count: xxx Refs: xxx */ |
778 | out += snprintf(buf + out, len - out, | 778 | out += snprintf(buf + out, len - out, |
779 | "Purge Count: %d Refs: %d\n", dlm->purge_count, | 779 | "Purge Count: %d Refs: %d\n", dlm->purge_count, |
780 | atomic_read(&dlm->dlm_refs.refcount)); | 780 | kref_read(&dlm->dlm_refs)); |
781 | 781 | ||
782 | /* Dead Node: xxx */ | 782 | /* Dead Node: xxx */ |
783 | out += snprintf(buf + out, len - out, | 783 | out += snprintf(buf + out, len - out, |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 733e4e79c8e2..32fd261ae13d 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -2072,7 +2072,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2072 | INIT_LIST_HEAD(&dlm->dlm_eviction_callbacks); | 2072 | INIT_LIST_HEAD(&dlm->dlm_eviction_callbacks); |
2073 | 2073 | ||
2074 | mlog(0, "context init: refcount %u\n", | 2074 | mlog(0, "context init: refcount %u\n", |
2075 | atomic_read(&dlm->dlm_refs.refcount)); | 2075 | kref_read(&dlm->dlm_refs)); |
2076 | 2076 | ||
2077 | leave: | 2077 | leave: |
2078 | if (ret < 0 && dlm) { | 2078 | if (ret < 0 && dlm) { |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index a464c8088170..7025d8c27999 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -233,7 +233,7 @@ static void __dlm_put_mle(struct dlm_master_list_entry *mle) | |||
233 | 233 | ||
234 | assert_spin_locked(&dlm->spinlock); | 234 | assert_spin_locked(&dlm->spinlock); |
235 | assert_spin_locked(&dlm->master_lock); | 235 | assert_spin_locked(&dlm->master_lock); |
236 | if (!atomic_read(&mle->mle_refs.refcount)) { | 236 | if (!kref_read(&mle->mle_refs)) { |
237 | /* this may or may not crash, but who cares. | 237 | /* this may or may not crash, but who cares. |
238 | * it's a BUG. */ | 238 | * it's a BUG. */ |
239 | mlog(ML_ERROR, "bad mle: %p\n", mle); | 239 | mlog(ML_ERROR, "bad mle: %p\n", mle); |
@@ -1124,9 +1124,9 @@ recheck: | |||
1124 | unsigned long timeo = msecs_to_jiffies(DLM_MASTERY_TIMEOUT_MS); | 1124 | unsigned long timeo = msecs_to_jiffies(DLM_MASTERY_TIMEOUT_MS); |
1125 | 1125 | ||
1126 | /* | 1126 | /* |
1127 | if (atomic_read(&mle->mle_refs.refcount) < 2) | 1127 | if (kref_read(&mle->mle_refs) < 2) |
1128 | mlog(ML_ERROR, "mle (%p) refs=%d, name=%.*s\n", mle, | 1128 | mlog(ML_ERROR, "mle (%p) refs=%d, name=%.*s\n", mle, |
1129 | atomic_read(&mle->mle_refs.refcount), | 1129 | kref_read(&mle->mle_refs), |
1130 | res->lockname.len, res->lockname.name); | 1130 | res->lockname.len, res->lockname.name); |
1131 | */ | 1131 | */ |
1132 | atomic_set(&mle->woken, 0); | 1132 | atomic_set(&mle->woken, 0); |
@@ -1979,7 +1979,7 @@ ok: | |||
1979 | * on this mle. */ | 1979 | * on this mle. */ |
1980 | spin_lock(&dlm->master_lock); | 1980 | spin_lock(&dlm->master_lock); |
1981 | 1981 | ||
1982 | rr = atomic_read(&mle->mle_refs.refcount); | 1982 | rr = kref_read(&mle->mle_refs); |
1983 | if (mle->inuse > 0) { | 1983 | if (mle->inuse > 0) { |
1984 | if (extra_ref && rr < 3) | 1984 | if (extra_ref && rr < 3) |
1985 | err = 1; | 1985 | err = 1; |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index 1082b2c3014b..63d701cd1e2e 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -251,7 +251,7 @@ leave: | |||
251 | mlog(0, "lock %u:%llu should be gone now! refs=%d\n", | 251 | mlog(0, "lock %u:%llu should be gone now! refs=%d\n", |
252 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | 252 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), |
253 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), | 253 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), |
254 | atomic_read(&lock->lock_refs.refcount)-1); | 254 | kref_read(&lock->lock_refs)-1); |
255 | dlm_lock_put(lock); | 255 | dlm_lock_put(lock); |
256 | } | 256 | } |
257 | if (actions & DLM_UNLOCK_CALL_AST) | 257 | if (actions & DLM_UNLOCK_CALL_AST) |
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index 1ddfa2928802..a232e7f0c869 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h | |||
@@ -247,7 +247,7 @@ static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb) | |||
247 | */ | 247 | */ |
248 | static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) | 248 | static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) |
249 | { | 249 | { |
250 | return atomic_read(&fb->base.refcount.refcount); | 250 | return kref_read(&fb->base.refcount); |
251 | } | 251 | } |
252 | 252 | ||
253 | /** | 253 | /** |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index cdbdb40eb5bd..feecf33a1212 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -878,7 +878,7 @@ static inline int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
878 | { | 878 | { |
879 | int ret; | 879 | int ret; |
880 | 880 | ||
881 | WARN_ON(!atomic_read(&bo->kref.refcount)); | 881 | WARN_ON(!kref_read(&bo->kref)); |
882 | 882 | ||
883 | ret = __ttm_bo_reserve(bo, interruptible, no_wait, ticket); | 883 | ret = __ttm_bo_reserve(bo, interruptible, no_wait, ticket); |
884 | if (likely(ret == 0)) | 884 | if (likely(ret == 0)) |
@@ -903,7 +903,7 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, | |||
903 | { | 903 | { |
904 | int ret = 0; | 904 | int ret = 0; |
905 | 905 | ||
906 | WARN_ON(!atomic_read(&bo->kref.refcount)); | 906 | WARN_ON(!kref_read(&bo->kref)); |
907 | 907 | ||
908 | if (interruptible) | 908 | if (interruptible) |
909 | ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, | 909 | ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, |
diff --git a/include/linux/kref.h b/include/linux/kref.h index 9af255ad1e2f..7c88d865f82f 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
@@ -35,6 +35,11 @@ static inline void kref_init(struct kref *kref) | |||
35 | atomic_set(&kref->refcount, 1); | 35 | atomic_set(&kref->refcount, 1); |
36 | } | 36 | } |
37 | 37 | ||
38 | static inline int kref_read(const struct kref *kref) | ||
39 | { | ||
40 | return atomic_read(&kref->refcount); | ||
41 | } | ||
42 | |||
38 | /** | 43 | /** |
39 | * kref_get - increment refcount for object. | 44 | * kref_get - increment refcount for object. |
40 | * @kref: object. | 45 | * @kref: object. |
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 62a60eeacb0a..8a511c0985aa 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
@@ -198,7 +198,7 @@ static inline struct cache_head *cache_get(struct cache_head *h) | |||
198 | 198 | ||
199 | static inline void cache_put(struct cache_head *h, struct cache_detail *cd) | 199 | static inline void cache_put(struct cache_head *h, struct cache_detail *cd) |
200 | { | 200 | { |
201 | if (atomic_read(&h->ref.refcount) <= 2 && | 201 | if (kref_read(&h->ref) <= 2 && |
202 | h->expiry_time < cd->nextcheck) | 202 | h->expiry_time < cd->nextcheck) |
203 | cd->nextcheck = h->expiry_time; | 203 | cd->nextcheck = h->expiry_time; |
204 | kref_put(&h->ref, cd->cache_put); | 204 | kref_put(&h->ref, cd->cache_put); |
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; |
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 1904a93f47d5..d491529332f4 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c | |||
@@ -920,7 +920,7 @@ static void chan_close_cb(struct l2cap_chan *chan) | |||
920 | BT_DBG("dev %p removing %speer %p", dev, | 920 | BT_DBG("dev %p removing %speer %p", dev, |
921 | last ? "last " : "1 ", peer); | 921 | last ? "last " : "1 ", peer); |
922 | BT_DBG("chan %p orig refcnt %d", chan, | 922 | BT_DBG("chan %p orig refcnt %d", chan, |
923 | atomic_read(&chan->kref.refcount)); | 923 | kref_read(&chan->kref)); |
924 | 924 | ||
925 | l2cap_chan_put(chan); | 925 | l2cap_chan_put(chan); |
926 | break; | 926 | break; |
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index 5f123c3320a7..f0095fd79818 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -810,7 +810,7 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked) | |||
810 | /* AMP Manager functions */ | 810 | /* AMP Manager functions */ |
811 | struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr) | 811 | struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr) |
812 | { | 812 | { |
813 | BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount)); | 813 | BT_DBG("mgr %p orig refcnt %d", mgr, kref_read(&mgr->kref)); |
814 | 814 | ||
815 | kref_get(&mgr->kref); | 815 | kref_get(&mgr->kref); |
816 | 816 | ||
@@ -833,7 +833,7 @@ static void amp_mgr_destroy(struct kref *kref) | |||
833 | 833 | ||
834 | int amp_mgr_put(struct amp_mgr *mgr) | 834 | int amp_mgr_put(struct amp_mgr *mgr) |
835 | { | 835 | { |
836 | BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount)); | 836 | BT_DBG("mgr %p orig refcnt %d", mgr, kref_read(&mgr->kref)); |
837 | 837 | ||
838 | return kref_put(&mgr->kref, &_mgr_destroy); | 838 | return kref_put(&mgr->kref, &_mgr_destroy); |
839 | } | 839 | } |
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index e32f34189007..02a4ccc04e1e 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
@@ -24,7 +24,7 @@ | |||
24 | void amp_ctrl_get(struct amp_ctrl *ctrl) | 24 | void amp_ctrl_get(struct amp_ctrl *ctrl) |
25 | { | 25 | { |
26 | BT_DBG("ctrl %p orig refcnt %d", ctrl, | 26 | BT_DBG("ctrl %p orig refcnt %d", ctrl, |
27 | atomic_read(&ctrl->kref.refcount)); | 27 | kref_read(&ctrl->kref)); |
28 | 28 | ||
29 | kref_get(&ctrl->kref); | 29 | kref_get(&ctrl->kref); |
30 | } | 30 | } |
@@ -42,7 +42,7 @@ static void amp_ctrl_destroy(struct kref *kref) | |||
42 | int amp_ctrl_put(struct amp_ctrl *ctrl) | 42 | int amp_ctrl_put(struct amp_ctrl *ctrl) |
43 | { | 43 | { |
44 | BT_DBG("ctrl %p orig refcnt %d", ctrl, | 44 | BT_DBG("ctrl %p orig refcnt %d", ctrl, |
45 | atomic_read(&ctrl->kref.refcount)); | 45 | kref_read(&ctrl->kref)); |
46 | 46 | ||
47 | return kref_put(&ctrl->kref, &_ctrl_destroy); | 47 | return kref_put(&ctrl->kref, &_ctrl_destroy); |
48 | } | 48 | } |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index ce0b5dd01953..fc7f321a3823 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -481,14 +481,14 @@ static void l2cap_chan_destroy(struct kref *kref) | |||
481 | 481 | ||
482 | void l2cap_chan_hold(struct l2cap_chan *c) | 482 | void l2cap_chan_hold(struct l2cap_chan *c) |
483 | { | 483 | { |
484 | BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->kref.refcount)); | 484 | BT_DBG("chan %p orig refcnt %d", c, kref_read(&c->kref)); |
485 | 485 | ||
486 | kref_get(&c->kref); | 486 | kref_get(&c->kref); |
487 | } | 487 | } |
488 | 488 | ||
489 | void l2cap_chan_put(struct l2cap_chan *c) | 489 | void l2cap_chan_put(struct l2cap_chan *c) |
490 | { | 490 | { |
491 | BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->kref.refcount)); | 491 | BT_DBG("chan %p orig refcnt %d", c, kref_read(&c->kref)); |
492 | 492 | ||
493 | kref_put(&c->kref, l2cap_chan_destroy); | 493 | kref_put(&c->kref, l2cap_chan_destroy); |
494 | } | 494 | } |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 770c52701efa..bad3d4ae43f6 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -3425,7 +3425,7 @@ static void ceph_msg_release(struct kref *kref) | |||
3425 | struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) | 3425 | struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) |
3426 | { | 3426 | { |
3427 | dout("%s %p (was %d)\n", __func__, msg, | 3427 | dout("%s %p (was %d)\n", __func__, msg, |
3428 | atomic_read(&msg->kref.refcount)); | 3428 | kref_read(&msg->kref)); |
3429 | kref_get(&msg->kref); | 3429 | kref_get(&msg->kref); |
3430 | return msg; | 3430 | return msg; |
3431 | } | 3431 | } |
@@ -3434,7 +3434,7 @@ EXPORT_SYMBOL(ceph_msg_get); | |||
3434 | void ceph_msg_put(struct ceph_msg *msg) | 3434 | void ceph_msg_put(struct ceph_msg *msg) |
3435 | { | 3435 | { |
3436 | dout("%s %p (was %d)\n", __func__, msg, | 3436 | dout("%s %p (was %d)\n", __func__, msg, |
3437 | atomic_read(&msg->kref.refcount)); | 3437 | kref_read(&msg->kref)); |
3438 | kref_put(&msg->kref, ceph_msg_release); | 3438 | kref_put(&msg->kref, ceph_msg_release); |
3439 | } | 3439 | } |
3440 | EXPORT_SYMBOL(ceph_msg_put); | 3440 | EXPORT_SYMBOL(ceph_msg_put); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 842f049abb86..f3378ba1a828 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -438,7 +438,7 @@ static void ceph_osdc_release_request(struct kref *kref) | |||
438 | void ceph_osdc_get_request(struct ceph_osd_request *req) | 438 | void ceph_osdc_get_request(struct ceph_osd_request *req) |
439 | { | 439 | { |
440 | dout("%s %p (was %d)\n", __func__, req, | 440 | dout("%s %p (was %d)\n", __func__, req, |
441 | atomic_read(&req->r_kref.refcount)); | 441 | kref_read(&req->r_kref)); |
442 | kref_get(&req->r_kref); | 442 | kref_get(&req->r_kref); |
443 | } | 443 | } |
444 | EXPORT_SYMBOL(ceph_osdc_get_request); | 444 | EXPORT_SYMBOL(ceph_osdc_get_request); |
@@ -447,7 +447,7 @@ void ceph_osdc_put_request(struct ceph_osd_request *req) | |||
447 | { | 447 | { |
448 | if (req) { | 448 | if (req) { |
449 | dout("%s %p (was %d)\n", __func__, req, | 449 | dout("%s %p (was %d)\n", __func__, req, |
450 | atomic_read(&req->r_kref.refcount)); | 450 | kref_read(&req->r_kref)); |
451 | kref_put(&req->r_kref, ceph_osdc_release_request); | 451 | kref_put(&req->r_kref, ceph_osdc_release_request); |
452 | } | 452 | } |
453 | } | 453 | } |
@@ -487,11 +487,11 @@ static void request_reinit(struct ceph_osd_request *req) | |||
487 | struct ceph_msg *reply_msg = req->r_reply; | 487 | struct ceph_msg *reply_msg = req->r_reply; |
488 | 488 | ||
489 | dout("%s req %p\n", __func__, req); | 489 | dout("%s req %p\n", __func__, req); |
490 | WARN_ON(atomic_read(&req->r_kref.refcount) != 1); | 490 | WARN_ON(kref_read(&req->r_kref) != 1); |
491 | request_release_checks(req); | 491 | request_release_checks(req); |
492 | 492 | ||
493 | WARN_ON(atomic_read(&request_msg->kref.refcount) != 1); | 493 | WARN_ON(kref_read(&request_msg->kref) != 1); |
494 | WARN_ON(atomic_read(&reply_msg->kref.refcount) != 1); | 494 | WARN_ON(kref_read(&reply_msg->kref) != 1); |
495 | target_destroy(&req->r_t); | 495 | target_destroy(&req->r_t); |
496 | 496 | ||
497 | request_init(req); | 497 | request_init(req); |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 8147e8d56eb2..f39e3e11f9aa 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -1358,7 +1358,7 @@ static int c_show(struct seq_file *m, void *p) | |||
1358 | ifdebug(CACHE) | 1358 | ifdebug(CACHE) |
1359 | seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n", | 1359 | seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n", |
1360 | convert_to_wallclock(cp->expiry_time), | 1360 | convert_to_wallclock(cp->expiry_time), |
1361 | atomic_read(&cp->ref.refcount), cp->flags); | 1361 | kref_read(&cp->ref), cp->flags); |
1362 | cache_get(cp); | 1362 | cache_get(cp); |
1363 | if (cache_check(cd, cp, NULL)) | 1363 | if (cache_check(cd, cp, NULL)) |
1364 | /* cache_check does a cache_put on failure */ | 1364 | /* cache_check does a cache_put on failure */ |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 3bc1d61694cb..04e7f8707d71 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -490,7 +490,7 @@ static struct svc_xprt *svc_xprt_dequeue(struct svc_pool *pool) | |||
490 | svc_xprt_get(xprt); | 490 | svc_xprt_get(xprt); |
491 | 491 | ||
492 | dprintk("svc: transport %p dequeued, inuse=%d\n", | 492 | dprintk("svc: transport %p dequeued, inuse=%d\n", |
493 | xprt, atomic_read(&xprt->xpt_ref.refcount)); | 493 | xprt, kref_read(&xprt->xpt_ref)); |
494 | } | 494 | } |
495 | spin_unlock_bh(&pool->sp_lock); | 495 | spin_unlock_bh(&pool->sp_lock); |
496 | out: | 496 | out: |
@@ -820,7 +820,7 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) | |||
820 | /* XPT_DATA|XPT_DEFERRED case: */ | 820 | /* XPT_DATA|XPT_DEFERRED case: */ |
821 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", | 821 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", |
822 | rqstp, rqstp->rq_pool->sp_id, xprt, | 822 | rqstp, rqstp->rq_pool->sp_id, xprt, |
823 | atomic_read(&xprt->xpt_ref.refcount)); | 823 | kref_read(&xprt->xpt_ref)); |
824 | rqstp->rq_deferred = svc_deferred_dequeue(xprt); | 824 | rqstp->rq_deferred = svc_deferred_dequeue(xprt); |
825 | if (rqstp->rq_deferred) | 825 | if (rqstp->rq_deferred) |
826 | len = svc_deferred_recv(rqstp); | 826 | len = svc_deferred_recv(rqstp); |
@@ -978,7 +978,7 @@ static void svc_age_temp_xprts(unsigned long closure) | |||
978 | * through, close it. */ | 978 | * through, close it. */ |
979 | if (!test_and_set_bit(XPT_OLD, &xprt->xpt_flags)) | 979 | if (!test_and_set_bit(XPT_OLD, &xprt->xpt_flags)) |
980 | continue; | 980 | continue; |
981 | if (atomic_read(&xprt->xpt_ref.refcount) > 1 || | 981 | if (kref_read(&xprt->xpt_ref) > 1 || |
982 | test_bit(XPT_BUSY, &xprt->xpt_flags)) | 982 | test_bit(XPT_BUSY, &xprt->xpt_flags)) |
983 | continue; | 983 | continue; |
984 | list_del_init(le); | 984 | list_del_init(le); |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index ca2799af05a6..39652d390a9c 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -1201,9 +1201,9 @@ static void __svc_rdma_free(struct work_struct *work) | |||
1201 | ib_drain_qp(rdma->sc_qp); | 1201 | ib_drain_qp(rdma->sc_qp); |
1202 | 1202 | ||
1203 | /* We should only be called from kref_put */ | 1203 | /* We should only be called from kref_put */ |
1204 | if (atomic_read(&xprt->xpt_ref.refcount) != 0) | 1204 | if (kref_read(&xprt->xpt_ref) != 0) |
1205 | pr_err("svcrdma: sc_xprt still in use? (%d)\n", | 1205 | pr_err("svcrdma: sc_xprt still in use? (%d)\n", |
1206 | atomic_read(&xprt->xpt_ref.refcount)); | 1206 | kref_read(&xprt->xpt_ref)); |
1207 | 1207 | ||
1208 | /* | 1208 | /* |
1209 | * Destroy queued, but not processed read completions. Note | 1209 | * Destroy queued, but not processed read completions. Note |