mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
Merge tag 'v4.18-rc5' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -349,3 +349,31 @@ bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock)
|
||||
}
|
||||
EXPORT_SYMBOL(refcount_dec_and_lock);
|
||||
|
||||
/**
|
||||
* refcount_dec_and_lock_irqsave - return holding spinlock with disabled
|
||||
* interrupts if able to decrement refcount to 0
|
||||
* @r: the refcount
|
||||
* @lock: the spinlock to be locked
|
||||
* @flags: saved IRQ-flags if the is acquired
|
||||
*
|
||||
* Same as refcount_dec_and_lock() above except that the spinlock is acquired
|
||||
* with disabled interupts.
|
||||
*
|
||||
* Return: true and hold spinlock if able to decrement refcount to 0, false
|
||||
* otherwise
|
||||
*/
|
||||
bool refcount_dec_and_lock_irqsave(refcount_t *r, spinlock_t *lock,
|
||||
unsigned long *flags)
|
||||
{
|
||||
if (refcount_dec_not_one(r))
|
||||
return false;
|
||||
|
||||
spin_lock_irqsave(lock, *flags);
|
||||
if (!refcount_dec_and_test(r)) {
|
||||
spin_unlock_irqrestore(lock, *flags);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(refcount_dec_and_lock_irqsave);
|
||||
|
Reference in New Issue
Block a user