diff options
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 7f6ee31d5650..a41f9fdb1aa0 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -226,12 +226,8 @@ static void * unflatten_dt_node(void *blob, | |||
226 | prev_pp = &np->properties; | 226 | prev_pp = &np->properties; |
227 | if (dad != NULL) { | 227 | if (dad != NULL) { |
228 | np->parent = dad; | 228 | np->parent = dad; |
229 | /* we temporarily use the next field as `last_child'*/ | 229 | np->sibling = dad->child; |
230 | if (dad->next == NULL) | 230 | dad->child = np; |
231 | dad->child = np; | ||
232 | else | ||
233 | dad->next->sibling = np; | ||
234 | dad->next = np; | ||
235 | } | 231 | } |
236 | } | 232 | } |
237 | /* process properties */ | 233 | /* process properties */ |
@@ -329,6 +325,22 @@ static void * unflatten_dt_node(void *blob, | |||
329 | 325 | ||
330 | if (*poffset < 0 && *poffset != -FDT_ERR_NOTFOUND) | 326 | if (*poffset < 0 && *poffset != -FDT_ERR_NOTFOUND) |
331 | pr_err("unflatten: error %d processing FDT\n", *poffset); | 327 | pr_err("unflatten: error %d processing FDT\n", *poffset); |
328 | |||
329 | /* | ||
330 | * Reverse the child list. Some drivers assumes node order matches .dts | ||
331 | * node order | ||
332 | */ | ||
333 | if (!dryrun && np->child) { | ||
334 | struct device_node *child = np->child; | ||
335 | np->child = NULL; | ||
336 | while (child) { | ||
337 | struct device_node *next = child->sibling; | ||
338 | child->sibling = np->child; | ||
339 | np->child = child; | ||
340 | child = next; | ||
341 | } | ||
342 | } | ||
343 | |||
332 | if (nodepp) | 344 | if (nodepp) |
333 | *nodepp = np; | 345 | *nodepp = np; |
334 | 346 | ||