From: Ralf Baechle <ralf@linux-mips.org>
To: Matteo Croce <technoboy85@gmail.com>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>,
linux-mips@linux-mips.org, florian@openwrt.org, nbd@openwrt.org,
ejka@imfi.kspu.ru, nico@openwrt.org,
openwrt-devel@lists.openwrt.org, akpm@linux-foundation.org
Subject: Re: [PATCH][MIPS][1/7] AR7: core support
Date: Wed, 12 Sep 2007 12:10:41 +0100 [thread overview]
Message-ID: <20070912111041.GB4571@linux-mips.org> (raw)
In-Reply-To: <200709120043.43452.technoboy85@gmail.com>
On Wed, Sep 12, 2007 at 12:43:42AM +0200, Matteo Croce wrote:
> > > --- a/arch/mips/kernel/traps.c
> > > +++ b/arch/mips/kernel/traps.c
> > > @@ -1075,9 +1075,23 @@ void *set_except_vector(int n, void *addr)
> > >
> > > exception_handlers[n] = handler;
> > > if (n == 0 && cpu_has_divec) {
> > > +#ifdef CONFIG_AR7
> > > + /* lui k0, 0x0000 */
> > > + *(volatile u32 *)(CAC_BASE+0x200) =
s/CAC_BASE/ebase/
> > > + 0x3c1a0000 | (handler >> 16);
> > > + /* ori k0, 0x0000 */
> > > + *(volatile u32 *)(CAC_BASE+0x204) =
> > > + 0x375a0000 | (handler & 0xffff);
> > > + /* jr k0 */
> > > + *(volatile u32 *)(CAC_BASE+0x208) = 0x03400008;
> > > + /* nop */
> > > + *(volatile u32 *)(CAC_BASE+0x20C) = 0x00000000;
> > > + flush_icache_range(CAC_BASE+0x200, CAC_BASE+0x210);
All these volatile keywords are unnecessary btw.
You may want to read Documentation/volatile-considered-harmful.txt on
why volatile is almost always a bad idea.
> > > +#else
> > > *(volatile u32 *)(ebase + 0x200) = 0x08000000 |
> > > (0x03ffffff & (handler >> 2));
Just like this one, so I will remove it now.
> > > flush_icache_range(ebase + 0x200, ebase + 0x204);
> > > +#endif
> > > }
> > > return (void *)old_handler;
> > > }
> >
> > Runtime checking, something like this would be better than ifdef:
> >
> > if ((handler ^ (ebase + 4)) & 0xfc000000)
> > /* use jr */
> > ...
> > } else {
> > /* use j */
> > ...
> > }
> This will not make the code bigger?
It will by a miniscule amount. Which hardly matters because the function
is (whops, should be ...) __init code anyway.
> What's wrong with #ifdef?
#ifdef makes for harder to read code (To paraphrase Linus - the kernel is
write once and read 10 million times) , is less flexible and has a tendence
to hide bugs in the deactivated part. So generally avoid.
And actually in this specific case it also should be a runtime decission
simply because in the not so distant future the will be hardware which
will simply need that.
Ralf
next prev parent reply other threads:[~2007-09-12 11:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200709080143.12345.technoboy85@gmail.com>
2007-09-08 0:18 ` [PATCH][MIPS][1/7] AR7: core support Matteo Croce
2007-09-08 17:40 ` Atsushi Nemoto
2007-09-11 22:43 ` Matteo Croce
2007-09-12 11:10 ` Ralf Baechle [this message]
2007-09-12 11:22 ` Thomas Bogendoerfer
2007-09-12 13:55 ` Ralf Baechle
2007-09-08 0:19 ` [PATCH][MIPS][2/7] AR7: mtd partition map Matteo Croce
2007-09-08 0:19 ` Matteo Croce
2007-09-08 0:20 ` [PATCH][MIPS][3/7] AR7: gpio char device Matteo Croce
2007-09-08 0:20 ` [PATCH][MIPS][4/7] AR7: leds driver Matteo Croce
2007-09-11 21:43 ` Richard Purdie
2007-09-08 0:21 ` [PATCH][MIPS][5/7] AR7: watchdog timer Matteo Croce
2007-09-08 0:22 ` [PATCH][MIPS][6/7] AR7: serial Matteo Croce
2007-09-08 0:23 ` [PATCH][MIPS][7/7] AR7: ethernet Matteo Croce
2007-09-12 16:50 ` Ralf Baechle
2007-09-13 1:42 ` Thiemo Seufer
2007-09-13 11:35 ` Ralf Baechle
2007-09-20 15:28 [PATCH][MIPS][0/7] AR7: 4th effort Matteo Croce
2007-09-20 15:43 ` [PATCH][MIPS][1/7] AR7: core support Matteo Croce
2007-09-21 1:57 ` Matteo Croce
2007-09-22 16:18 ` Atsushi Nemoto
-- strict thread matches above, loose matches on Subject: below --
2007-09-06 15:18 Matteo Croce
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=20070912111041.GB4571@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=akpm@linux-foundation.org \
--cc=anemo@mba.ocn.ne.jp \
--cc=ejka@imfi.kspu.ru \
--cc=florian@openwrt.org \
--cc=linux-mips@linux-mips.org \
--cc=nbd@openwrt.org \
--cc=nico@openwrt.org \
--cc=openwrt-devel@lists.openwrt.org \
--cc=technoboy85@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.