linux-mips
[Top] [All Lists]

Re: c-r4k.c cleanup

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: c-r4k.c cleanup
From: David Daney <ddaney@avtrex.com>
Date: Fri, 04 Feb 2005 09:51:50 -0800
Cc: Dominic Sweetman <dom@mips.com>, Nigel Stephens <nigel@mips.com>, Atsushi Nemoto <anemo@mba.ocn.ne.jp>, linux-mips@linux-mips.org
In-reply-to: <20050204155340.GB22217@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20050204.231254.74753794.anemo@mba.ocn.ne.jp> <4203890B.5030305@mips.com> <20050204145803.GA5618@linux-mips.org> <16899.37525.412441.558873@gargle.gargle.HOWL> <20050204154532.GA22217@linux-mips.org> <20050204155340.GB22217@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)
Ralf Baechle wrote:
This is what I've checked in.

  Ralf

Index: arch/mips/mm/c-r4k.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/c-r4k.c,v
retrieving revision 1.97
diff -u -r1.97 c-r4k.c
--- arch/mips/mm/c-r4k.c        4 Feb 2005 15:19:01 -0000       1.97
+++ arch/mips/mm/c-r4k.c        4 Feb 2005 15:48:38 -0000
@@ -1012,9 +1012,17 @@
         * normally they'd suffer from aliases but magic in the hardware deals
         * with that for us so we don't need to take care ourselves.
         */
-       if (c->cputype != CPU_R10000 && c->cputype != CPU_R12000)
+       switch (c->cputype) {
                if (c->dcache.waysize > PAGE_SIZE)
-                       c->dcache.flags |= MIPS_CACHE_ALIASES;
+                       
+       case CPU_R10000:
+       case CPU_R12000:
+               break;
+       case CPU_24K:
+               if (!(read_c0_config7() & (1 << 16)))
+       default:
+                       c->dcache.flags |= MIPS_CACHE_ALIASES;
+       }
switch (c->cputype) {
        case CPU_20KC:

That may be legal C, but I have a difficult time figuring out exactly what it is supposed to do as case labels in the middle of statements confuses me.

Does the first if in the switch do anything? My reading of the spec indicates that it is unreachable code.

Just my $0.02

David Daney.

<Prev in Thread] Current Thread [Next in Thread>