X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=drivers%2Fcore%2Fof_access.c;h=c31cba7fd6b501fd6ffcb5ee0c5ba0a239f52dfa;hb=19d1f1a2f3ccfbf85125150f7876ce22714b38bd;hp=94ef3cc251fb4b567e69bb485a73c8c07da85c28;hpb=b07d044d5bfa8c440b172eb3f8a9d537f82e21b6;p=platform%2Fkernel%2Fu-boot.git diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index 94ef3cc..c31cba7 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -96,6 +96,30 @@ int of_n_size_cells(const struct device_node *np) return OF_ROOT_NODE_SIZE_CELLS_DEFAULT; } +int of_simple_addr_cells(const struct device_node *np) +{ + const __be32 *ip; + + ip = of_get_property(np, "#address-cells", NULL); + if (ip) + return be32_to_cpup(ip); + + /* Return a default of 2 to match fdt_address_cells()*/ + return 2; +} + +int of_simple_size_cells(const struct device_node *np) +{ + const __be32 *ip; + + ip = of_get_property(np, "#size-cells", NULL); + if (ip) + return be32_to_cpup(ip); + + /* Return a default of 2 to match fdt_size_cells()*/ + return 2; +} + struct property *of_find_property(const struct device_node *np, const char *name, int *lenp) { @@ -244,6 +268,12 @@ static struct device_node *__of_get_next_child(const struct device_node *node, return NULL; next = prev ? prev->sibling : node->child; + /* + * coverity[dead_error_line : FALSE] + * Dead code here since our current implementation of of_node_get() + * always returns NULL (Coverity CID 163245). But we leave it as is + * since we may want to implement get/put later. + */ for (; next; next = next->sibling) if (of_node_get(next)) break; @@ -635,6 +665,13 @@ int of_parse_phandle_with_args(const struct device_node *np, index, out_args); } +int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, const char *cells_name) +{ + return __of_parse_phandle_with_args(np, list_name, cells_name, 0, + -1, NULL); +} + static void of_alias_add(struct alias_prop *ap, struct device_node *np, int id, const char *stem, int stem_len) {