diff options
Diffstat (limited to 'include/linux/kref.h')
-rw-r--r-- | include/linux/kref.h | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/include/linux/kref.h b/include/linux/kref.h index 484604d184be..e15828fd71f1 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/atomic.h> | 19 | #include <linux/atomic.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/spinlock.h> | ||
23 | 22 | ||
24 | struct kref { | 23 | struct kref { |
25 | atomic_t refcount; | 24 | atomic_t refcount; |
@@ -99,38 +98,6 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref) | |||
99 | return kref_sub(kref, 1, release); | 98 | return kref_sub(kref, 1, release); |
100 | } | 99 | } |
101 | 100 | ||
102 | /** | ||
103 | * kref_put_spinlock_irqsave - decrement refcount for object. | ||
104 | * @kref: object. | ||
105 | * @release: pointer to the function that will clean up the object when the | ||
106 | * last reference to the object is released. | ||
107 | * This pointer is required, and it is not acceptable to pass kfree | ||
108 | * in as this function. | ||
109 | * @lock: lock to take in release case | ||
110 | * | ||
111 | * Behaves identical to kref_put with one exception. If the reference count | ||
112 | * drops to zero, the lock will be taken atomically wrt dropping the reference | ||
113 | * count. The release function has to call spin_unlock() without _irqrestore. | ||
114 | */ | ||
115 | static inline int kref_put_spinlock_irqsave(struct kref *kref, | ||
116 | void (*release)(struct kref *kref), | ||
117 | spinlock_t *lock) | ||
118 | { | ||
119 | unsigned long flags; | ||
120 | |||
121 | WARN_ON(release == NULL); | ||
122 | if (atomic_add_unless(&kref->refcount, -1, 1)) | ||
123 | return 0; | ||
124 | spin_lock_irqsave(lock, flags); | ||
125 | if (atomic_dec_and_test(&kref->refcount)) { | ||
126 | release(kref); | ||
127 | local_irq_restore(flags); | ||
128 | return 1; | ||
129 | } | ||
130 | spin_unlock_irqrestore(lock, flags); | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static inline int kref_put_mutex(struct kref *kref, | 101 | static inline int kref_put_mutex(struct kref *kref, |
135 | void (*release)(struct kref *kref), | 102 | void (*release)(struct kref *kref), |
136 | struct mutex *lock) | 103 | struct mutex *lock) |