Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/kref.h
Show All 32 Lines | |||||
#define _LINUX_KREF_H_ | #define _LINUX_KREF_H_ | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/refcount.h> | #include <sys/refcount.h> | ||||
#include <linux/compiler.h> | #include <linux/compiler.h> | ||||
#include <linux/kernel.h> | #include <linux/kernel.h> | ||||
#include <linux/mutex.h> | #include <linux/mutex.h> | ||||
#include <linux/refcount.h> | |||||
#include <asm/atomic.h> | #include <asm/atomic.h> | ||||
struct kref { | struct kref { | ||||
atomic_t refcount; | atomic_t refcount; | ||||
}; | }; | ||||
static inline void | static inline void | ||||
Show All 22 Lines | |||||
{ | { | ||||
if (refcount_release(&kref->refcount.counter)) { | if (refcount_release(&kref->refcount.counter)) { | ||||
rel(kref); | rel(kref); | ||||
return 1; | return 1; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
static inline int | |||||
kref_put_lock(struct kref *kref, void (*rel)(struct kref *kref), | |||||
spinlock_t *lock) | |||||
{ | |||||
if (refcount_release(&kref->refcount.counter)) { | |||||
spin_lock(lock); | |||||
rel(kref); | |||||
return (1); | |||||
hselasky: ()'s around return argument. | |||||
} | |||||
return (0); | |||||
Done Inline Actionsditto. hselasky: ditto. | |||||
} | |||||
static inline int | static inline int | ||||
kref_sub(struct kref *kref, unsigned int count, | kref_sub(struct kref *kref, unsigned int count, | ||||
void (*rel)(struct kref *kref)) | void (*rel)(struct kref *kref)) | ||||
{ | { | ||||
while (count--) { | while (count--) { | ||||
if (refcount_release(&kref->refcount.counter)) { | if (refcount_release(&kref->refcount.counter)) { | ||||
Show All 31 Lines |
()'s around return argument.