[PATCH] locking/mutex: define conditional guard for for mutex_lock_killable()

Carlos López posted 1 patch 1 month, 2 weeks ago
include/linux/mutex.h | 1 +
1 file changed, 1 insertion(+)
[PATCH] locking/mutex: define conditional guard for for mutex_lock_killable()
Posted by Carlos López 1 month, 2 weeks ago
Allow using guards with mutex_lock_killable(), just like we currently do
with mutex_lock_interruptable(), e.g.

    scoped_guard(mutex_killable, &my_mutex) {
        ...
    }

Signed-off-by: Carlos López <clopez@suse.de>
---
 include/linux/mutex.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index bf535f0118bb..931a139e6176 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -253,6 +253,7 @@ extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
 DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))
 DEFINE_GUARD_COND(mutex, _try, mutex_trylock(_T))
 DEFINE_GUARD_COND(mutex, _intr, mutex_lock_interruptible(_T), _RET == 0)
+DEFINE_GUARD_COND(mutex, _killable, mutex_lock_killable(_T), _RET == 0)
 
 extern unsigned long mutex_get_owner(struct mutex *lock);
 
-- 
2.51.0