Skip to content

Commit 3a66d7d

Browse files
Bart Van AsscheNicholas Bellinger
authored andcommitted
kref: Remove kref_put_spinlock_irqsave()
The last user is gone. Hence remove this function. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 9ff9d15 commit 3a66d7d

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

include/linux/kref.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/atomic.h>
2020
#include <linux/kernel.h>
2121
#include <linux/mutex.h>
22-
#include <linux/spinlock.h>
2322

2423
struct kref {
2524
atomic_t refcount;
@@ -99,38 +98,6 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)
9998
return kref_sub(kref, 1, release);
10099
}
101100

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-
134101
static inline int kref_put_mutex(struct kref *kref,
135102
void (*release)(struct kref *kref),
136103
struct mutex *lock)

0 commit comments

Comments
 (0)