Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758145AbYHASWu (ORCPT ); Fri, 1 Aug 2008 14:22:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753262AbYHASW2 (ORCPT ); Fri, 1 Aug 2008 14:22:28 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:48388 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752551AbYHASW1 (ORCPT ); Fri, 1 Aug 2008 14:22:27 -0400 Date: Fri, 1 Aug 2008 11:22:12 -0700 (PDT) From: Linus Torvalds To: Andrew Morton cc: Rusty Russell , Paul Menage , linux-kernel@vger.kernel.org, Matthew Wilcox , "Randy.Dunlap" , Christoph Hellwig Subject: Re: [PATCH] Introduce down_try() so we can move away from down_trylock() In-Reply-To: <20080801104046.e9e8d6fd.akpm@linux-foundation.org> Message-ID: References: <200807291015.02865.rusty@rustcorp.com.au> <6599ad830807281727r63a57a1g11972c5395828aae@mail.gmail.com> <200807292301.18733.rusty@rustcorp.com.au> <20080801104046.e9e8d6fd.akpm@linux-foundation.org> User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1477 Lines: 40 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/