]> git.sur5r.net Git - u-boot/blobdiff - lib/libfdt/fdt_ro.c
MIPS: kconfig: add options for endianess select
[u-boot] / lib / libfdt / fdt_ro.c
index fec4a0a141fdd3e556e4f7aede81417c0be81fdf..03733e574f71db1df2ebec2c08ec66dff95908d0 100644 (file)
@@ -537,6 +537,36 @@ int fdt_find_string(const void *fdt, int node, const char *property,
        return -FDT_ERR_NOTFOUND;
 }
 
+int fdt_get_string_index(const void *fdt, int node, const char *property,
+                        int index, const char **output)
+{
+       const char *list;
+       int length, i;
+
+       list = fdt_getprop(fdt, node, property, &length);
+
+       for (i = 0; i < length; i++) {
+               int len = strlen(list);
+
+               if (index == 0) {
+                       *output = list;
+                       return 0;
+               }
+
+               list += len + 1;
+               i += len;
+               index--;
+       }
+
+       return FDT_ERR_NOTFOUND;
+}
+
+int fdt_get_string(const void *fdt, int node, const char *property,
+                  const char **output)
+{
+       return fdt_get_string_index(fdt, node, property, 0, output);
+}
+
 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
                              const char *compatible)
 {