Merge branch 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6

* 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6:
of/promtree: allow DT device matching by fixing 'name' brokenness (v5)
x86: OLPC: have prom_early_alloc BUG rather than return NULL
of/flattree: Drop an uninteresting message to pr_debug level
of: Add missing of_address.h to xilinx ehci driver

+45 -73
+1 -2
arch/x86/platform/olpc/olpc_dt.c
··· 140 140 * wasted bootmem) and hand off chunks of it to callers. 141 141 */ 142 142 res = alloc_bootmem(chunk_size); 143 - if (!res) 144 - return NULL; 143 + BUG_ON(!res); 145 144 prom_early_allocated += chunk_size; 146 145 memset(res, 0, chunk_size); 147 146 free_mem = chunk_size;
+42 -70
drivers/of/pdt.c
··· 36 36 (p)->unique_id = of_pdt_unique_id++; \ 37 37 } while (0) 38 38 39 - static inline const char *of_pdt_node_name(struct device_node *dp) 39 + static char * __init of_pdt_build_full_name(struct device_node *dp) 40 40 { 41 - return dp->path_component_name; 41 + int len, ourlen, plen; 42 + char *n; 43 + 44 + dp->path_component_name = build_path_component(dp); 45 + 46 + plen = strlen(dp->parent->full_name); 47 + ourlen = strlen(dp->path_component_name); 48 + len = ourlen + plen + 2; 49 + 50 + n = prom_early_alloc(len); 51 + strcpy(n, dp->parent->full_name); 52 + if (!of_node_is_root(dp->parent)) { 53 + strcpy(n + plen, "/"); 54 + plen++; 55 + } 56 + strcpy(n + plen, dp->path_component_name); 57 + 58 + return n; 42 59 } 43 60 44 - #else 61 + #else /* CONFIG_SPARC */ 45 62 46 63 static inline void of_pdt_incr_unique_id(void *p) { } 47 64 static inline void irq_trans_init(struct device_node *dp) { } 48 65 49 - static inline const char *of_pdt_node_name(struct device_node *dp) 66 + static char * __init of_pdt_build_full_name(struct device_node *dp) 50 67 { 51 - return dp->name; 68 + static int failsafe_id = 0; /* for generating unique names on failure */ 69 + char *buf; 70 + int len; 71 + 72 + if (of_pdt_prom_ops->pkg2path(dp->phandle, NULL, 0, &len)) 73 + goto failsafe; 74 + 75 + buf = prom_early_alloc(len + 1); 76 + if (of_pdt_prom_ops->pkg2path(dp->phandle, buf, len, &len)) 77 + goto failsafe; 78 + return buf; 79 + 80 + failsafe: 81 + buf = prom_early_alloc(strlen(dp->parent->full_name) + 82 + strlen(dp->name) + 16); 83 + sprintf(buf, "%s/%s@unknown%i", 84 + of_node_is_root(dp->parent) ? "" : dp->parent->full_name, 85 + dp->name, failsafe_id++); 86 + pr_err("%s: pkg2path failed; assigning %s\n", __func__, buf); 87 + return buf; 52 88 } 53 89 54 90 #endif /* !CONFIG_SPARC */ ··· 168 132 return buf; 169 133 } 170 134 171 - static char * __init of_pdt_try_pkg2path(phandle node) 172 - { 173 - char *res, *buf = NULL; 174 - int len; 175 - 176 - if (!of_pdt_prom_ops->pkg2path) 177 - return NULL; 178 - 179 - if (of_pdt_prom_ops->pkg2path(node, buf, 0, &len)) 180 - return NULL; 181 - buf = prom_early_alloc(len + 1); 182 - if (of_pdt_prom_ops->pkg2path(node, buf, len, &len)) { 183 - pr_err("%s: package-to-path failed\n", __func__); 184 - return NULL; 185 - } 186 - 187 - res = strrchr(buf, '/'); 188 - if (!res) { 189 - pr_err("%s: couldn't find / in %s\n", __func__, buf); 190 - return NULL; 191 - } 192 - return res+1; 193 - } 194 - 195 - /* 196 - * When fetching the node's name, first try using package-to-path; if 197 - * that fails (either because the arch hasn't supplied a PROM callback, 198 - * or some other random failure), fall back to just looking at the node's 199 - * 'name' property. 200 - */ 201 - static char * __init of_pdt_build_name(phandle node) 202 - { 203 - char *buf; 204 - 205 - buf = of_pdt_try_pkg2path(node); 206 - if (!buf) 207 - buf = of_pdt_get_one_property(node, "name"); 208 - 209 - return buf; 210 - } 211 - 212 135 static struct device_node * __init of_pdt_create_node(phandle node, 213 136 struct device_node *parent) 214 137 { ··· 182 187 183 188 kref_init(&dp->kref); 184 189 185 - dp->name = of_pdt_build_name(node); 190 + dp->name = of_pdt_get_one_property(node, "name"); 186 191 dp->type = of_pdt_get_one_property(node, "device_type"); 187 192 dp->phandle = node; 188 193 ··· 191 196 irq_trans_init(dp); 192 197 193 198 return dp; 194 - } 195 - 196 - static char * __init of_pdt_build_full_name(struct device_node *dp) 197 - { 198 - int len, ourlen, plen; 199 - char *n; 200 - 201 - plen = strlen(dp->parent->full_name); 202 - ourlen = strlen(of_pdt_node_name(dp)); 203 - len = ourlen + plen + 2; 204 - 205 - n = prom_early_alloc(len); 206 - strcpy(n, dp->parent->full_name); 207 - if (!of_node_is_root(dp->parent)) { 208 - strcpy(n + plen, "/"); 209 - plen++; 210 - } 211 - strcpy(n + plen, of_pdt_node_name(dp)); 212 - 213 - return n; 214 199 } 215 200 216 201 static struct device_node * __init of_pdt_build_tree(struct device_node *parent, ··· 215 240 *(*nextp) = dp; 216 241 *nextp = &dp->allnext; 217 242 218 - #if defined(CONFIG_SPARC) 219 - dp->path_component_name = build_path_component(dp); 220 - #endif 221 243 dp->full_name = of_pdt_build_full_name(dp); 222 244 223 245 dp->child = of_pdt_build_tree(dp,
+1
drivers/usb/host/ehci-xilinx-of.c
··· 29 29 30 30 #include <linux/of.h> 31 31 #include <linux/of_platform.h> 32 + #include <linux/of_address.h> 32 33 33 34 /** 34 35 * ehci_xilinx_of_setup - Initialize the device for ehci_reset()
+1 -1
fs/proc/proc_devtree.c
··· 233 233 return; 234 234 root = of_find_node_by_path("/"); 235 235 if (root == NULL) { 236 - printk(KERN_ERR "/proc/device-tree: can't find root\n"); 236 + pr_debug("/proc/device-tree: can't find root\n"); 237 237 return; 238 238 } 239 239 proc_device_tree_add_node(root, proc_device_tree);