aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_framebuffer.h2
-rw-r--r--include/drm/ttm/ttm_bo_driver.h4
-rw-r--r--include/linux/kref.h5
-rw-r--r--include/linux/sunrpc/cache.h2
-rw-r--r--include/net/bluetooth/hci_core.h4
5 files changed, 11 insertions, 6 deletions
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 */
248static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) 248static 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
38static 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
199static inline void cache_put(struct cache_head *h, struct cache_detail *cd) 199static 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)
987static inline void hci_dev_put(struct hci_dev *d) 987static 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)
995static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) 995static 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;