All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerald Champagne <gerald.champagne@esstech.com>
To: "linux-mips@oss.sgi.com" <linux-mips@oss.sgi.com>
Subject: Remove ifdefs from setup_arch()
Date: Wed, 03 Oct 2001 14:11:26 -0500	[thread overview]
Message-ID: <3BBB62DE.3040003@esstech.com> (raw)


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

             reply	other threads:[~2001-10-03 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-03 19:11 Gerald Champagne [this message]
2001-10-03 19:29 ` Remove ifdefs from setup_arch() 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

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=3BBB62DE.3040003@esstech.com \
    --to=gerald.champagne@esstech.com \
    --cc=linux-mips@oss.sgi.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.