All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Hiroshi Doyu <hdoyu@nvidia.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC 2/4] driver core: Allow early registration of devices
Date: Fri, 16 Aug 2013 14:06:37 -0700	[thread overview]
Message-ID: <20130816210637.GC2198@kroah.com> (raw)
In-Reply-To: <1376685563-1053-3-git-send-email-treding@nvidia.com>

On Fri, Aug 16, 2013 at 10:39:21PM +0200, Thierry Reding wrote:
> +static DEFINE_MUTEX(device_early_mutex);
> +static LIST_HEAD(device_early_list);
> +static bool device_is_early = true;
> +
> +/*
> + * Keep a list of early registered devices so that they can be fully
> + * registered at a later point in time.
> + */
> +static void device_early_add(struct device *dev)

__init?

> +{
> +	mutex_lock(&device_early_mutex);
> +	list_add_tail(&dev->p->early, &device_early_list);
> +	mutex_unlock(&device_early_mutex);
> +}
> +
> +/*
> + * Mark the early device registration phase as completed.
> + */
> +int __init device_early_init(void)
> +{
> +	device_is_early = false;
> +
> +	return 0;
> +}
> +
> +/*
> + * Fixup platform devices instantiated from device tree. The problem is
> + * that since early registration happens before interrupt controllers
> + * have been setup, the OF core code won't know how to map interrupts.
> + */
> +int __init platform_device_early_fixup(struct platform_device *pdev)

This shouldn't be in this file, because:

> +/*
> + * Fully register early devices.
> + */
> +int __init device_early_done(void)
> +{
> +	struct device_private *private;
> +
> +	list_for_each_entry(private, &device_early_list, early) {
> +		struct device *dev = private->device;
> +		int err;
> +
> +		if (dev->bus == &platform_bus_type) {

Why special case the platform bus?  We are trying to move things off of
the platform bus, don't make it harder to do that :)

> +			struct platform_device *pdev = to_platform_device(dev);
> +
> +			err = platform_device_early_fixup(pdev);
> +			if (err < 0)
> +				dev_err(&pdev->dev,
> +					"failed to fixup device %s: %d\n",
> +					dev_name(&pdev->dev), err);
> +		}

You should just have a bus callback that can be made here that, if
present, can be called.  That way any bus can handle this type of thing,
not just the platform one.


Not that I really like the whole idea anyway, but I doubt there's much I
can do about it...

thanks,

greg k-h

  reply	other threads:[~2013-08-17  0:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16 20:39 [RFC 0/4] Early device registration Thierry Reding
2013-08-16 20:39 ` [RFC 1/4] driver core: Register SoC bus after platform bus Thierry Reding
2013-08-16 20:39 ` [RFC 2/4] driver core: Allow early registration of devices Thierry Reding
2013-08-16 21:06   ` Greg Kroah-Hartman [this message]
2013-08-16 21:55     ` Thierry Reding
2013-08-16 22:08       ` Greg Kroah-Hartman
2013-08-17 11:17         ` Thierry Reding
2013-08-19 19:43           ` Stephen Warren
2013-08-19 20:10             ` Thierry Reding
2013-08-19 20:53               ` Stephen Warren
2013-08-19 21:41                 ` Thierry Reding
2013-08-16 22:20       ` Grant Likely
2013-08-16 22:35         ` Greg Kroah-Hartman
2013-08-17 10:26         ` Tomasz Figa
2013-08-19 19:49           ` Stephen Warren
2013-08-19 20:04             ` Thierry Reding
2013-08-17 11:07         ` Thierry Reding
2013-08-16 20:39 ` [RFC 3/4] ARM: tegra: Call of_platform_populate() early Thierry Reding
2013-08-16 20:39 ` [RFC 4/4] OF: Add device pointer to struct device_node Thierry Reding

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=20130816210637.GC2198@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=hdoyu@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.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.