linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Tony Breeds <tony@bakeyournoodle.com>
Cc: linuxppc-dev@ozlabs.org, Nathan Lynch <ntl@pobox.com>
Subject: Re: [PATCH] Quieten arch/powerpc in a allmodconfig build.
Date: Wed, 08 Apr 2009 16:48:03 +1000	[thread overview]
Message-ID: <1239173283.10104.38.camel@localhost> (raw)
In-Reply-To: <20090408055126.GG16602@bilbo.ozlabs.org>

[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]

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:

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);
 }


cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-04-08  6:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08  4:36 [PATCH] Quieten arch/powerpc in a allmodconfig build Tony Breeds
2009-04-08  5:08 ` Michael Ellerman
2009-04-08  5:51   ` Tony Breeds
2009-04-08  6:13     ` Tony Breeds
2009-04-08  6:23       ` Michael Ellerman
2009-04-08  6:48     ` Michael Ellerman [this message]
2009-04-08  7:42       ` Geert Uytterhoeven
2009-04-08 18:47       ` Nathan Lynch
2009-04-09  0:01         ` Tony Breeds
2009-04-10  4:21           ` Nathan Lynch
2009-04-10 17:19             ` Segher Boessenkool
2009-04-09 22:46     ` Segher Boessenkool
2009-04-09 22:45       ` Tony Breeds
2009-04-09 23:11         ` Stephen Rothwell
2009-04-09 23:23           ` Segher Boessenkool
2009-04-10 18:03             ` Scott Wood
2009-04-10 18:35               ` Andreas Schwab
2009-04-10 18:43                 ` Scott Wood
2009-04-10 20:28                   ` Segher Boessenkool
2009-04-10 20:45               ` Segher Boessenkool
2009-04-10 21:51                 ` Scott Wood
2009-04-09 23:18         ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239173283.10104.38.camel@localhost \
    --to=michael@ellerman.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=ntl@pobox.com \
    --cc=tony@bakeyournoodle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).