Re: [PATCH] Introduce down_try() so we can move away fromdown_trylock()

From: Linus Torvalds
Date: Fri Aug 01 2008 - 14:22:52 EST




On Fri, 1 Aug 2008, Andrew Morton wrote:

> >
>
> The naming is pretty sad, but the inconsistent return value from
> down_trylock() drives me batshit. It means that every time I ever look
> at any sort of trylock call I need to go back to the definition site to
> work out if it's the one which returns true or if it's the one which
> returns false.
>
> It would be good to get that fixed. And if we _do_ want to fix it, I
> don't see any alternative to creating a new function.

The alternative is to just get rid of "down_trylock()" entirely. Creatign
a shadow function with a different return value is just going to confuse
people even more than the current situation.

That's why I pointed out that all the current users (apart from the
special console usage) really do look like prime candidates to just
convert to mutexes.

Of course, regardless, _some_ of those have actually taken the
down_trylock semantics. See

#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)

so nothing gets rid of that ;)

But at least it should be possible to replace something like half the
current users of down_trylock() by just teh trivial conversion to mutexes.
Which would be a good thing regardless.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/