Date: Sun, 31 Jan 2010 10:21:25 GMT From: Rafal Jaworowski <raj@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 173999 for review Message-ID: <201001311021.o0VALPE4033049@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=173999 Change 173999 by raj@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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001311021.o0VALPE4033049>