Skip to content

Commit

Permalink
locking/mutex: Kill mutex_trylock_recursive()
Browse files Browse the repository at this point in the history
There are not users of mutex_trylock_recursive() in tree as of
v5.11-rc7.

Remove it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210210085248.219210-2-bigeasy@linutronix.de
  • Loading branch information
Sebastian Andrzej Siewior authored and Peter Zijlstra committed Feb 10, 2021
1 parent b38085b commit 0f319d4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
25 changes: 0 additions & 25 deletions include/linux/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,29 +199,4 @@ extern void mutex_unlock(struct mutex *lock);

extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);

/*
* These values are chosen such that FAIL and SUCCESS match the
* values of the regular mutex_trylock().
*/
enum mutex_trylock_recursive_enum {
MUTEX_TRYLOCK_FAILED = 0,
MUTEX_TRYLOCK_SUCCESS = 1,
MUTEX_TRYLOCK_RECURSIVE,
};

/**
* mutex_trylock_recursive - trylock variant that allows recursive locking
* @lock: mutex to be locked
*
* This function should not be used, _ever_. It is purely for hysterical GEM
* raisins, and once those are gone this will be removed.
*
* Returns:
* - MUTEX_TRYLOCK_FAILED - trylock failed,
* - MUTEX_TRYLOCK_SUCCESS - lock acquired,
* - MUTEX_TRYLOCK_RECURSIVE - we already owned the lock.
*/
extern /* __deprecated */ __must_check enum mutex_trylock_recursive_enum
mutex_trylock_recursive(struct mutex *lock);

#endif /* __LINUX_MUTEX_H */
10 changes: 0 additions & 10 deletions kernel/locking/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@ bool mutex_is_locked(struct mutex *lock)
}
EXPORT_SYMBOL(mutex_is_locked);

__must_check enum mutex_trylock_recursive_enum
mutex_trylock_recursive(struct mutex *lock)
{
if (unlikely(__mutex_owner(lock) == current))
return MUTEX_TRYLOCK_RECURSIVE;

return mutex_trylock(lock);
}
EXPORT_SYMBOL(mutex_trylock_recursive);

static inline unsigned long __owner_flags(unsigned long owner)
{
return owner & MUTEX_FLAGS;
Expand Down

0 comments on commit 0f319d4

Please sign in to comment.