From: Tom Rini <trini@kernel.crashing.org>
To: Andries.Brouwer@cwi.nl
Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org,
torvalds@transmeta.com
Subject: Re: [PATCH] setup_per_cpu_areas in 2.5.8pre3
Date: Wed, 17 Apr 2002 08:11:37 -0700 [thread overview]
Message-ID: <20020417151137.GB27144@opus.bloom.county> (raw)
In-Reply-To: <UTC200204170824.g3H8OTZ28753.aeb@smtp.cwi.nl>
On Wed, Apr 17, 2002 at 10:24:29AM +0200, Andries.Brouwer@cwi.nl wrote:
> #ifdef's are evil. You have one, and there are two possible sources.
> Easy and readable. You have two, and there are four. Already a small
> effort to check that indeed all four combinations are OK. That was
> what went wrong in the setup_per_cpu_areas case. You have three and
> it is almost certain that someone forgets to check all possible
> eight cases.
How does the following patch look ? It's alot longer than the rest but
imho it makes things readable as well.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
===== init/main.c 1.40 vs edited =====
--- 1.40/init/main.c Tue Apr 9 13:35:31 2002
+++ edited/init/main.c Mon Apr 15 08:56:20 2002
@@ -261,20 +261,7 @@
extern void setup_arch(char **);
extern void cpu_idle(void);
-#ifndef CONFIG_SMP
-
-#ifdef CONFIG_X86_LOCAL_APIC
-static void __init smp_init(void)
-{
- APIC_init_uniprocessor();
-}
-#else
-#define smp_init() do { } while (0)
-#endif
-
-#else
-
-#ifdef __GENERIC_PER_CPU
+#if defined(CONFIG_SMP) && defined(__GENERIC_PER_CPU)
unsigned long __per_cpu_offset[NR_CPUS];
static void __init setup_per_cpu_areas(void)
@@ -300,8 +287,9 @@
static inline void setup_per_cpu_areas(void)
{
}
-#endif /* !__GENERIC_PER_CPU */
+#endif
+#ifdef CONFIG_SMP
/* Called by boot processor to activate the rest. */
static void __init smp_init(void)
{
@@ -311,7 +299,15 @@
smp_threads_ready=1;
smp_commence();
}
-
+#else
+#ifdef CONFIG_X86_LOCAL_APIC
+static void __init smp_init(void)
+{
+ APIC_init_uniprocessor();
+}
+#else
+#define smp_init() do { } while (0)
+#endif
#endif
/*
next prev parent reply other threads:[~2002-04-17 15:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-17 8:24 Andries.Brouwer
2002-04-17 15:11 ` Tom Rini [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-04-14 21:15 Andries.Brouwer
2002-04-16 12:48 ` Rusty Russell
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=20020417151137.GB27144@opus.bloom.county \
--to=trini@kernel.crashing.org \
--cc=Andries.Brouwer@cwi.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@transmeta.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
all inboxes | Powered by JetHome®