Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[deliverable/linux.git] / drivers / mtd / ofpart.c
index 553d6d6d560322c4bcafa44a184e6c09e864b621..d64f8c30945fbcd8e2d09a5b8342e75c081cd343 100644 (file)
 #include <linux/slab.h>
 #include <linux/mtd/partitions.h>
 
+static bool node_has_compatible(struct device_node *pp)
+{
+       return of_get_property(pp, "compatible", NULL);
+}
+
 static int parse_ofpart_partitions(struct mtd_info *master,
                                   struct mtd_partition **pparts,
                                   struct mtd_part_parser_data *data)
@@ -38,10 +43,13 @@ static int parse_ofpart_partitions(struct mtd_info *master,
                return 0;
 
        /* First count the subnodes */
-       pp = NULL;
        nr_parts = 0;
-       while ((pp = of_get_next_child(node, pp)))
+       for_each_child_of_node(node,  pp) {
+               if (node_has_compatible(pp))
+                       continue;
+
                nr_parts++;
+       }
 
        if (nr_parts == 0)
                return 0;
@@ -50,13 +58,15 @@ static int parse_ofpart_partitions(struct mtd_info *master,
        if (!*pparts)
                return -ENOMEM;
 
-       pp = NULL;
        i = 0;
-       while ((pp = of_get_next_child(node, pp))) {
+       for_each_child_of_node(node,  pp) {
                const __be32 *reg;
                int len;
                int a_cells, s_cells;
 
+               if (node_has_compatible(pp))
+                       continue;
+
                reg = of_get_property(pp, "reg", &len);
                if (!reg) {
                        nr_parts--;
This page took 0.025562 seconds and 5 git commands to generate.