When to #ifdef on CPUs?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
register.

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
pointers.

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...

Matt

--
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                      www.momenco.com



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux