linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Brown <davidb@codeaurora.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: David Brown <davidb@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH RFC] arm: Add argument to init_machine
Date: Wed, 8 Dec 2010 09:50:00 -0800	[thread overview]
Message-ID: <20101208175000.GA20265@huya.qualcomm.com> (raw)
In-Reply-To: <20101208172732.GQ9777@n2100.arm.linux.org.uk>

On Wed, Dec 08, 2010 at 05:27:32PM +0000, Russell King - ARM Linux wrote:

> Well, that depends on how you're going to use this.
> 
> Generally, we find that it's best to arrange the common stuff as
> libraries, and have the platform specific code call the library
> functions to perform the common work.
> 
> Calling a common function from the platform methods and putting
> lots of if (machine_is_xxx()) in it certainly isn't the right method.

The idea is to reduce the machine_is_xxx() calls.  I'll have a clearer
patch soon, but it basically lets us need only one machine init
function for a group of boards, so instead of something like:

	void board1_init(void)
	{
		init_thing(parameter1);
		init_stuff(parameter2);
	}

	void board2_init(void)
	{
		init_thing(parameter1b);
		init_stuff(parameter2b);
	}

(or having machine_is_xxx() calls): we end up with

	void board_family_init(void *arg)
	{
		struct board_family_data *priv = arg;

		init_thing(priv->parameter1);
		init_stuff(priv->parameter2);
	}

I do share a bit of the concern that the mechanism can be abused, but
I've also found that nearly everything in the board files gets abused.

David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

      reply	other threads:[~2010-12-08 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08  0:42 [PATCH RFC] arm: Add argument to init_machine David Brown
2010-12-08 14:07 ` Russell King - ARM Linux
2010-12-08 17:24   ` David Brown
2010-12-08 17:27     ` Russell King - ARM Linux
2010-12-08 17:50       ` David Brown [this message]

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=20101208175000.GA20265@huya.qualcomm.com \
    --to=davidb@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).