]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Export fdt_stringlist_contains()
authorSimon Glass <sjg@chromium.org>
Mon, 21 Jan 2013 20:59:18 +0000 (12:59 -0800)
committerGerald Van Baren <vanbaren@cideas.com>
Fri, 10 May 2013 23:04:49 +0000 (19:04 -0400)
This function is useful outside libfdt, so export it.

Ref: DTC commit b7aa300e

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
include/libfdt.h
lib/libfdt/fdt_ro.c

index fc7f75b9ffa60b6bc23f44d39b59c4d0f4b7be3b..b153cc31bfb27fadca016cd534cbe368e6761470 100644 (file)
@@ -816,6 +816,20 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
                                  const char *compatible);
 
+/**
+ * fdt_stringlist_contains - check a string list property for a string
+ * @strlist: Property containing a list of strings to check
+ * @listlen: Length of property
+ * @str: String to search for
+ *
+ * This is a utility function provided for convenience. The list contains
+ * one or more strings, each terminated by \0, as is found in a device tree
+ * "compatible" property.
+ *
+ * @return: 1 if the string is found in the list, 0 not found, or invalid list
+ */
+int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
+
 /**********************************************************************/
 /* Write-in-place functions                                           */
 /**********************************************************************/
index 1a461c3e9795150ffe154568e68dc81b70afd77b..b65f4e23ad7b019e37993282090b1a99aab36770 100644 (file)
@@ -519,8 +519,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
        return offset; /* error from fdt_next_node() */
 }
 
-static int _fdt_stringlist_contains(const char *strlist, int listlen,
-                                   const char *str)
+int fdt_stringlist_contains(const char *strlist, int listlen, const char *str)
 {
        int len = strlen(str);
        const char *p;
@@ -546,7 +545,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
        prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
        if (!prop)
                return len;
-       if (_fdt_stringlist_contains(prop, len, compatible))
+       if (fdt_stringlist_contains(prop, len, compatible))
                return 0;
        else
                return 1;