Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
[sfrench/cifs-2.6.git] / arch / powerpc / kernel / prom.c
index caef555f2dc06a1f1b20e225d3b272d36c378ee9..af42ddab3ab473ba7f9085c3a28d2f37fb4672c7 100644 (file)
@@ -716,11 +716,40 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
        return 0;
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+static void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+       unsigned long l;
+       u32 *prop;
+
+       DBG("Looking for initrd properties... ");
+
+       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
+       if (prop) {
+               initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
+
+               prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
+               if (prop) {
+                       initrd_end = (unsigned long)
+                                       __va(of_read_ulong(prop, l/4));
+                       initrd_below_start_ok = 1;
+               } else {
+                       initrd_start = 0;
+               }
+       }
+
+       DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
+}
+#else
+static inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 static int __init early_init_dt_scan_chosen(unsigned long node,
                                            const char *uname, int depth, void *data)
 {
        unsigned long *lprop;
-       u32 *prop;
        unsigned long l;
        char *p;
 
@@ -762,21 +791,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
                crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
 
-#ifdef CONFIG_BLK_DEV_INITRD
-       DBG("Looking for initrd properties... ");
-       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-       if (prop) {
-               initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
-               prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-               if (prop) {
-                       initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
-                       initrd_below_start_ok = 1;
-               } else {
-                       initrd_start = 0;
-               }
-       }
-       DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
-#endif /* CONFIG_BLK_DEV_INITRD */
+       early_init_dt_check_for_initrd(node);
 
        /* Retreive command line */
        p = of_get_flat_dt_prop(node, "bootargs", &l);
@@ -1156,11 +1171,12 @@ EXPORT_SYMBOL(of_find_node_by_name);
 
 /**
  *     of_find_node_by_type - Find a node by its "device_type" property
- *     @from:  The node to start searching from or NULL, the node
- *             you pass will not be searched, only the next one
- *             will; typically, you pass what the previous call
- *             returned. of_node_put() will be called on it
- *     @name:  The type string to match against
+ *     @from:  The node to start searching from, or NULL to start searching
+ *             the entire device tree. The node you pass will not be
+ *             searched, only the next one will; typically, you pass
+ *             what the previous call returned. of_node_put() will be
+ *             called on from for you.
+ *     @type:  The type string to match against
  *
  *     Returns a node pointer with refcount incremented, use
  *     of_node_put() on it when done.
@@ -1457,6 +1473,11 @@ static int of_finish_dynamic_node(struct device_node *node)
        node->name = of_get_property(node, "name", NULL);
        node->type = of_get_property(node, "device_type", NULL);
 
+       if (!node->name)
+               node->name = "<NULL>";
+       if (!node->type)
+               node->type = "<NULL>";
+
        if (!parent) {
                err = -ENODEV;
                goto out;