mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	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: [RFC 4/4] OF: Add device pointer to struct device_node
Date: Fri, 16 Aug 2013 22:39:23 +0200	[thread overview]
Message-ID: <1376685563-1053-5-git-send-email-treding@nvidia.com> (raw)
In-Reply-To: <1376685563-1053-1-git-send-email-treding@nvidia.com>

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/of/device.c   |  2 ++
 drivers/of/platform.c | 10 +---------
 include/linux/of.h    |  2 ++
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/of/device.c b/drivers/of/device.c
index f685e55..8f8e715 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -63,6 +63,8 @@ int of_device_add(struct platform_device *ofdev)
 	if (!ofdev->dev.parent)
 		set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node));
 
+	ofdev->dev.of_node->dev = &ofdev->dev;
+
 	return device_add(&ofdev->dev);
 }
 
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index b0d1ff8..0ae68bd 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -31,11 +31,6 @@ const struct of_device_id of_default_bus_match_table[] = {
 	{} /* Empty terminated list */
 };
 
-static int of_dev_node_match(struct device *dev, void *data)
-{
-	return dev->of_node == data;
-}
-
 /**
  * of_find_device_by_node - Find the platform_device associated with a node
  * @np: Pointer to device tree node
@@ -44,10 +39,7 @@ static int of_dev_node_match(struct device *dev, void *data)
  */
 struct platform_device *of_find_device_by_node(struct device_node *np)
 {
-	struct device *dev;
-
-	dev = bus_find_device(&platform_bus_type, NULL, np, of_dev_node_match);
-	return dev ? to_platform_device(dev) : NULL;
+	return np->dev ? to_platform_device(np->dev) : NULL;
 }
 EXPORT_SYMBOL(of_find_device_by_node);
 
diff --git a/include/linux/of.h b/include/linux/of.h
index 17ce8a6..e583a6d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -65,6 +65,8 @@ struct device_node {
 	unsigned int unique_id;
 	struct of_irq_controller *irq_trans;
 #endif
+
+	struct device *dev;
 };
 
 #define MAX_PHANDLE_ARGS 8
-- 
1.8.3.4


      parent reply	other threads:[~2013-08-16 22:16 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
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 ` Thierry Reding [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=1376685563-1053-5-git-send-email-treding@nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.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 \
    /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

Powered by JetHome