PERFORCE change 173999 for review

Rafal Jaworowski raj at FreeBSD.org
Sun Jan 31 10:21:26 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=173999

Change 173999 by raj at raj_fdt on 2010/01/31 10:20:48

	Introduce a helper fdt_find_compatible() routine.
	
	This is used early when ofw I/F is not available yet; note this is
	traversal through the whole device tree (slow).

Affected files ...

.. //depot/projects/fdt/sys/dev/fdt/fdt_common.c#8 edit
.. //depot/projects/fdt/sys/dev/fdt/fdt_common.h#4 edit

Differences ...

==== //depot/projects/fdt/sys/dev/fdt/fdt_common.c#8 (text+ko) ====

@@ -97,6 +97,20 @@
 	return (rv);
 }
 
+phandle_t
+fdt_find_compatible(phandle_t start, const char *compat)
+{
+	phandle_t child;
+
+	/*
+	 * Traverse all children of 'start' node, and find first with
+	 * matching 'compatible' property.
+	 */
+	for (child = OF_child(start); child != 0; child = OF_peer(child))
+		if (fdt_is_compatible(child, compat))
+			return (child);
+	return (0);
+}
 
 int
 fdt_is_enabled(phandle_t node)

==== //depot/projects/fdt/sys/dev/fdt/fdt_common.h#4 (text+ko) ====

@@ -53,5 +53,6 @@
 int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *);
 int fdt_is_compatible(phandle_t, const char *);
 int fdt_is_enabled(phandle_t);
+phandle_t fdt_find_compatible(phandle_t start, const char *compat);
 
 #endif /* FDT_COMMON_H */


More information about the p4-projects mailing list