Re: [PATCH -v4 1/8] locking/drm: Kill mutex trickery

From: Waiman Long
Date: Fri Oct 07 2016 - 17:59:40 EST


On 10/07/2016 12:13 PM, Peter Zijlstra wrote:
On Fri, Oct 07, 2016 at 08:58:43AM -0700, Linus Torvalds wrote:
The other choice would be to just make the choices be negative (==
recursive), zero (== failed) or positive (== got lock), which allows
for the same value re-use for the non-recursive case, and you could
avoid the enum entirely.
I thought about that, but liked the enum better for having to then spell
it out.

I'll go make the enum shout and add comment as you suggest.

I like the idea of having a tri-state returned value (<0, 0, >0). I don't mind having the enum, but just making mutex_trylock_recursive equal to -1 will be great.

Cheers,
Longman