Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Remove ifdefs from setup_arch()
@ 2001-10-03 19:11 Gerald Champagne
  2001-10-03 19:29 ` Ralf Baechle
  0 siblings, 1 reply; 7+ messages in thread
From: Gerald Champagne @ 2001-10-03 19:11 UTC (permalink / raw)
  To: linux-mips@oss.sgi.com


I have been modifying the linux kernel to support a custom hardware board of 
ours, and I'm trying to minimize additional changes and ifdefs in the kernel.
I noticed that the setup_arch function in arch/mips/kernel/setup.c has a new
ifdef for each board type that is supported, and it looks like this could be
simplified.  The code looks something like this:

-----------------
void __init setup_arch(char **cmdline_p)
{
	void boardname1_setup(void);
	void boardname1_setup(void);
	void boardname1_setup(void);

	...

	switch (mips_machgroup)
	{
#ifdef CONFIG_BOARDNAME1
	case: MACH_GROUP_WHATEVER1:
		boardname1_setup();
		break;
#endif

#ifdef CONFIG_BOARDNAME2
	case: MACH_GROUP_WHATEVER2:
		boardname2_setup();
		break;
#endif

#ifdef CONFIG_BOARDNAME3
	case: MACH_GROUP_WHATEVER3:
		boardname3_setup();
		break;
#endif

	default:
		panic("Unsupported architecture");
	}
	...
-----------------


For each configuration, only one case is compiled in.  Wouldn't it
be simpler to just give the board-specific setup function a common name
and consider it part of the board-specific api like all the other
board-specific functions.  Can this be changed to just this:

-----------------
void __init setup_arch(char **cmdline_p)
{
	void foo_setup(void);

	...

	foo_setup();  /* someone pick a name for this */
	...
-----------------

I'm trying to document an api for supporting an arbitrary board, and little
things like this make it more difficult to define something along the lines
of a bsp interface.  Any suggestions?  Any objections?

Thanks.

Gerald

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-10-12 21:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-03 19:11 Remove ifdefs from setup_arch() Gerald Champagne
2001-10-03 19:29 ` Ralf Baechle
2001-10-03 21:11   ` Jun Sun
2001-10-12 11:52     ` Geert Uytterhoeven
2001-10-12 17:44       ` Jun Sun
2001-10-12 18:13         ` Gerald Champagne
2001-10-12 21:35           ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox