mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
linuxkpi: Implement atomic_dec_and_lock_irqsave()
This is needed by the drm-kmod 5.5 update.
Reviewed by: hselasky, manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29988
(cherry picked from commit ce65353ac1)
This commit is contained in:
parent
3e6b8bcf6e
commit
da6a8ccfa2
2 changed files with 14 additions and 1 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#ifndef _LINUX_SPINLOCK_H_
|
||||
#define _LINUX_SPINLOCK_H_
|
||||
|
||||
#include <asm/atomic.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
|
|
@ -160,4 +161,16 @@ spin_lock_destroy(spinlock_t *lock)
|
|||
mtx_assert(&(_l)->m, MA_OWNED); \
|
||||
} while (0)
|
||||
|
||||
static inline int
|
||||
atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock,
|
||||
unsigned long flags)
|
||||
{
|
||||
spin_lock_irqsave(lock, flags);
|
||||
if (atomic_dec_and_test(cnt)) {
|
||||
return (1);
|
||||
}
|
||||
spin_unlock_irqrestore(lock, flags);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_SPINLOCK_H_ */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
* in the range 5 to 9.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 1300501 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 1300502 /* Master, propagated to newvers */
|
||||
|
||||
/*
|
||||
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||
|
|
|
|||
Loading…
Reference in a new issue