Merge remote-tracking branch 'lsk/v3.10/topic/of' into linux-linaro-lsk
authorMark Brown <broonie@kernel.org>
Mon, 16 Feb 2015 03:51:52 +0000 (12:51 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 16 Feb 2015 03:51:52 +0000 (12:51 +0900)
Conflicts:
drivers/of/base.c
drivers/of/fdt.c

1  2 
drivers/of/address.c
drivers/of/base.c
drivers/of/fdt.c
include/linux/of.h

Simple merge
index 191b370b102e983f80152ae0df832fef994d295c,a181a61b222dea9ef6704044241ba35830804824..fe11d06be0a82e263a9ac40e7639d868d47eb42e
@@@ -1118,80 -1069,22 +1118,25 @@@ int of_property_read_string_helper(stru
                return -EINVAL;
        if (!prop->value)
                return -ENODATA;
 -      if (strnlen(prop->value, prop->length) >= prop->length)
 -              return -EILSEQ;
 -
        p = prop->value;
 +      end = p + prop->length;
  
 -      for (i = 0; total < prop->length; total += l, p += l, i++)
 -              l = strlen(p) + 1;
 -
 -      return i;
 +      for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l) {
 +              l = strnlen(p, end - p) + 1;
 +              if (p + l > end)
 +                      return -EILSEQ;
 +              if (out_strs && i >= skip)
 +                      *out_strs++ = p;
 +      }
 +      i -= skip;
 +      return i <= 0 ? -ENODATA : i;
  }
 -EXPORT_SYMBOL_GPL(of_property_count_strings);
 +EXPORT_SYMBOL_GPL(of_property_read_string_helper);
  
- /**
-  * of_parse_phandle - Resolve a phandle property to a device_node pointer
-  * @np: Pointer to device node holding phandle property
-  * @phandle_name: Name of property holding a phandle value
-  * @index: For properties holding a table of phandles, this is the index into
-  *         the table
-  *
-  * Returns the device_node pointer with refcount incremented.  Use
-  * of_node_put() on it when done.
-  */
- struct device_node *of_parse_phandle(const struct device_node *np,
-                                    const char *phandle_name, int index)
- {
-       const __be32 *phandle;
-       int size;
-       phandle = of_get_property(np, phandle_name, &size);
-       if ((!phandle) || (size < sizeof(*phandle) * (index + 1)))
-               return NULL;
-       return of_find_node_by_phandle(be32_to_cpup(phandle + index));
- }
- EXPORT_SYMBOL(of_parse_phandle);
- /**
-  * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
-  * @np:               pointer to a device tree node containing a list
-  * @list_name:        property name that contains a list
-  * @cells_name:       property name that specifies phandles' arguments count
-  * @index:    index of a phandle to parse out
-  * @out_args: optional pointer to output arguments structure (will be filled)
-  *
-  * This function is useful to parse lists of phandles and their arguments.
-  * Returns 0 on success and fills out_args, on error returns appropriate
-  * errno value.
-  *
-  * Caller is responsible to call of_node_put() on the returned out_args->node
-  * pointer.
-  *
-  * Example:
-  *
-  * phandle1: node1 {
-  *    #list-cells = <2>;
-  * }
-  *
-  * phandle2: node2 {
-  *    #list-cells = <1>;
-  * }
-  *
-  * node3 {
-  *    list = <&phandle1 1 2 &phandle2 3>;
-  * }
-  *
-  * To get a device_node of the `node2' node you may call this:
-  * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
-  */
  static int __of_parse_phandle_with_args(const struct device_node *np,
                                        const char *list_name,
-                                       const char *cells_name, int index,
+                                       const char *cells_name,
+                                       int cell_count, int index,
                                        struct of_phandle_args *out_args)
  {
        const __be32 *list, *list_end;
index 4911158cba8a154b80aaeac44ef39a05741d93df,cafff538c85044d1e196c0cebb3e88d3fc75f352..fa951c30a1c5d1566cc8b6423362ed1af63b6d3f
@@@ -335,18 -388,22 +334,20 @@@ static void __unflatten_device_tree(str
        pr_debug("  size is %lx, allocating...\n", size);
  
        /* Allocate memory for the expanded device tree */
 -      mem = (unsigned long)
 -              dt_alloc(size + 4, __alignof__(struct device_node));
 +      mem = dt_alloc(size + 4, __alignof__(struct device_node));
 +
 +      memset((void *)mem, 0, size);
  
+       memset((void *)mem, 0, size);
        ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
  
 -      pr_debug("  unflattening %lx...\n", mem);
 +      pr_debug("  unflattening %p...\n", mem);
  
        /* Second pass, do actual unflattening */
 -      start = ((unsigned long)blob) +
 -              be32_to_cpu(blob->off_dt_struct);
 +      start = 0;
        unflatten_dt_node(blob, mem, &start, NULL, &allnextp, 0);
 -      if (be32_to_cpup((__be32 *)start) != OF_DT_END)
 -              pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
 -      if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef)
 +      if (be32_to_cpup(mem + size) != 0xdeadbeef)
                pr_warning("End of tree marker overwritten: %08x\n",
                           be32_to_cpu(((__be32 *)mem)[size / 4]));
        *allnextp = NULL;
Simple merge