[Top] [All Lists]

When to #ifdef on CPUs?

To: "Linux-MIPS" <>
Subject: When to #ifdef on CPUs?
From: "Matthew Dharm" <>
Date: Thu, 12 Sep 2002 18:58:57 -0700
Importance: Normal
Original-recipient: rfc822;
I'm basically done with my task of porting linux to our SR71000-based
board.  I'm getting ready to start feeding patches to Ralf, and
something occured to me....

Sometimes, in some places, we use CONFIG_ options to select the
apropriate CPU.  Other places, we probe for the CPU based on the PRID

In some places, the reason for the choice is clear -- it's just much
easier to select the cache library based on a CONFIG_ option in a
Makefile than trying to do run-time assignment of many function

However, is some places, the choice is not clear.  In cpu-probe.c, for
example, several of the CPU identification routines are wrapped in
#ifdef's -- odd, since the wrong 'case' of the switch statements
should never get executed, even if compiled in....

So, what's the rule here?  When do I used #ifdef and when do I just
let the PRID stuff work it's magic?

I mean, heck... it might be nice to put a check to see if the detected
CPU matches what the kernel was compiled for...


Matthew D. Dharm                            Senior Software Designer
Momentum Computer Inc.                      1815 Aston Ave.  Suite 107
(760) 431-8663 X-115                        Carlsbad, CA 92008-7310
Momentum Works For You            

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