From patchwork Wed Apr 8 06:48:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 25708 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id E6B40DE266 for ; Wed, 8 Apr 2009 16:48:35 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id DBAD7DDF04 for ; Wed, 8 Apr 2009 16:48:04 +1000 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id 73AF9B6F3A; Wed, 8 Apr 2009 16:48:04 +1000 (EST) Subject: Re: [PATCH] Quieten arch/powerpc in a allmodconfig build. From: Michael Ellerman To: Tony Breeds In-Reply-To: <20090408055126.GG16602@bilbo.ozlabs.org> References: <2c4bcf8d1d7083ff53ce5b556765e96676a007fb.1239165378.git.tony@bakeyournoodle.com> <1239167335.10104.26.camel@localhost> <20090408055126.GG16602@bilbo.ozlabs.org> Date: Wed, 08 Apr 2009 16:48:03 +1000 Message-Id: <1239173283.10104.38.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.3 Cc: linuxppc-dev@ozlabs.org, Nathan Lynch X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: michael@ellerman.id.au List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org On Wed, 2009-04-08 at 15:51 +1000, Tony Breeds wrote: > On Wed, Apr 08, 2009 at 03:08:55PM +1000, Michael Ellerman wrote: > > > The getter routines in here could really multiplex their return values > > with a negative error code, which I generally prefer, but this works I > > guess. > > I was hoping someone would notice and suggest it. tag you're it! I meant we /could/ change them, but we could also leave them, it's a bit of a coin-flip which is better. Nathan might have an opinion? Something like this: cheers diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index bb37b1d..9f3a155 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -191,7 +191,7 @@ static void cache_cpu_set(struct cache *cache, int cpu) } } -static int cache_size(const struct cache *cache, unsigned int *ret) +static int cache_size(const struct cache *cache) { const char *propname; const u32 *cache_size; @@ -202,19 +202,18 @@ static int cache_size(const struct cache *cache, unsigned if (!cache_size) return -ENODEV; - *ret = *cache_size; - return 0; + return cache_size; } -static int cache_size_kb(const struct cache *cache, unsigned int *ret) +static int cache_size_kb(const struct cache *cache) { unsigned int size; - if (cache_size(cache, &size)) - return -ENODEV; + size = cache_size(cache); + if (size < 0) + return size; - *ret = size / 1024; - return 0; + return size / 1024; } /* not cache_line_size() because that's a macro in include/linux/cache.h */ @@ -515,8 +514,9 @@ static ssize_t size_show(struct kobject *k, struct kobj_attr cache = index_kobj_to_cache(k); - if (cache_size_kb(cache, &size_kb)) - return -ENODEV; + size_kb = cache_size_kb(cache); + if (size_kb < 0) + return size_kb; return sprintf(buf, "%uK\n", size_kb); }