[PATCH v1] drivers: of: register DT root as device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A usual board file contains at least one of_machine_is_compatible().
Some of the have a rather ling list with complicated version logic.

To avoid own implementation for driver management, register the root node
of devicetree as platform device. So, the main platform bus can attach
proper board driver. After this patch a typical board.c file can reuse
existing driver infrastructure.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 drivers/of/platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index ca84cede23..ab4329314e 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -348,6 +348,7 @@ int of_platform_populate(struct device_node *root,
 			struct device_d *parent)
 {
 	struct device_node *child;
+	struct device_d *dev;
 	int rc = 0;
 
 	if (!root)
@@ -355,6 +356,10 @@ int of_platform_populate(struct device_node *root,
 	if (!root)
 		return -EINVAL;
 
+	dev = of_platform_device_create(root, NULL);
+	if (dev)
+		dev_set_name(dev, "%s.of", "machine");
+
 	for_each_child_of_node(root, child) {
 		rc = of_platform_bus_create(child, matches, parent);
 		if (rc)
-- 
2.27.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux