[PATCH] Quieten arch/powerpc in a allmodconfig build.

Michael Ellerman michael at ellerman.id.au
Wed Apr 8 16:48:03 EST 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090408/f9f55435/attachment.pgp>


More information about the Linuxppc-dev mailing list