linuxkpi: Add refcount_dec_and_test
In Linux this takes a refcount_t argument but in linuxkpi struct kref uses an atomic_t for the refcount and code in drm directly uses this function with a kref so use an atomic_t here. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36099
This commit is contained in:
parent
4370e9f1cf
commit
1a6874e3a4
@ -43,6 +43,7 @@
|
||||
#include <asm/atomic.h>
|
||||
|
||||
struct kref {
|
||||
/* XXX In Linux this is a refcount_t */
|
||||
atomic_t refcount;
|
||||
};
|
||||
|
||||
|
@ -79,4 +79,15 @@ refcount_dec_and_lock_irqsave(refcount_t *ref, spinlock_t *lock,
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* struct kref uses atomic_t and not refcount_t so
|
||||
* we differ from Linux here.
|
||||
*/
|
||||
static inline bool
|
||||
refcount_dec_and_test(atomic_t *r)
|
||||
{
|
||||
|
||||
return (atomic_dec_and_test(r));
|
||||
}
|
||||
|
||||
#endif /* __LINUXKPI_LINUX_REFCOUNT_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user