]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/of/base.c
scsi: ufs: Unlock on a couple error paths
[linux.git] / drivers / of / base.c
index 1d667eb730e197d7de686a074f6194c1036a64b6..db7fbc0c0893cdb609034486b0d9f300ad029d49 100644 (file)
@@ -86,34 +86,46 @@ static bool __of_node_is_type(const struct device_node *np, const char *type)
        return np && match && type && !strcmp(match, type);
 }
 
-int of_n_addr_cells(struct device_node *np)
+int of_bus_n_addr_cells(struct device_node *np)
 {
        u32 cells;
 
-       do {
-               if (np->parent)
-                       np = np->parent;
+       for (; np; np = np->parent)
                if (!of_property_read_u32(np, "#address-cells", &cells))
                        return cells;
-       } while (np->parent);
+
        /* No #address-cells property for the root node */
        return OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
 }
+
+int of_n_addr_cells(struct device_node *np)
+{
+       if (np->parent)
+               np = np->parent;
+
+       return of_bus_n_addr_cells(np);
+}
 EXPORT_SYMBOL(of_n_addr_cells);
 
-int of_n_size_cells(struct device_node *np)
+int of_bus_n_size_cells(struct device_node *np)
 {
        u32 cells;
 
-       do {
-               if (np->parent)
-                       np = np->parent;
+       for (; np; np = np->parent)
                if (!of_property_read_u32(np, "#size-cells", &cells))
                        return cells;
-       } while (np->parent);
+
        /* No #size-cells property for the root node */
        return OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
 }
+
+int of_n_size_cells(struct device_node *np)
+{
+       if (np->parent)
+               np = np->parent;
+
+       return of_bus_n_size_cells(np);
+}
 EXPORT_SYMBOL(of_n_size_cells);
 
 #ifdef CONFIG_NUMA