[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1376685563-1053-5-git-send-email-treding@nvidia.com>
Date: Fri, 16 Aug 2013 22:39:23 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Grant Likely <grant.likely@...aro.org>
Cc: Rob Herring <rob.herring@...xeda.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Stephen Warren <swarren@...dotorg.org>,
Hiroshi Doyu <hdoyu@...dia.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC 4/4] OF: Add device pointer to struct device_node
Signed-off-by: Thierry Reding <treding@...dia.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists