[PATCH 5/8] of: of_path: find device via partuuid

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

 



When a node is compatible to a fixed-partitions, support searching the
corresponding device via the partuuid, if it is specified in the devicetree.

Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
 drivers/of/of_path.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index 334eab841a01..e53041b0a16c 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -56,11 +56,26 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
 
 	dev = of_find_device_by_node_path(node->full_name);
 	if (!dev) {
+		int ret;
+		const char *uuid;
 		struct device_node *devnode = node->parent;
 
-		if (of_device_is_compatible(devnode, "fixed-partitions"))
+		if (of_device_is_compatible(devnode, "fixed-partitions")) {
 			devnode = devnode->parent;
 
+			/* when partuuid is specified short-circuit the search for the cdev */
+			ret = of_property_read_string(node, "partuuid", &uuid);
+			if (!ret) {
+				cdev = cdev_by_partuuid(uuid);
+				if (!cdev)
+					return -ENODEV;
+
+				*outpath = basprintf("/dev/%s", cdev->name);
+
+				return 0;
+			}
+		}
+
 		dev = of_find_device_by_node_path(devnode->full_name);
 		if (!dev)
 			return -ENODEV;
-- 
2.11.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