[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 31/72] dt: allow add_subnode to create root subnodes
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 31/72] dt: allow add_subnode to create root subnodes |
Date: |
Sun, 24 Jun 2012 01:06:55 +0200 |
Our subnode creation helper can't handle creation of root subnodes,
like "/memory". Fix this by allowing the parent node to be an empty
string, indicating the root node.
Signed-off-by: Alexander Graf <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>
---
device_tree.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index 86a694c..94a239e 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -151,6 +151,7 @@ int qemu_devtree_add_subnode(void *fdt, const char *name)
char *dupname = g_strdup(name);
char *basename = strrchr(dupname, '/');
int retval;
+ int parent = 0;
if (!basename) {
g_free(dupname);
@@ -160,7 +161,11 @@ int qemu_devtree_add_subnode(void *fdt, const char *name)
basename[0] = '\0';
basename++;
- retval = fdt_add_subnode(fdt, findnode_nofail(fdt, dupname), basename);
+ if (dupname[0]) {
+ parent = findnode_nofail(fdt, dupname);
+ }
+
+ retval = fdt_add_subnode(fdt, parent, basename);
if (retval < 0) {
fprintf(stderr, "FDT: Failed to create subnode %s: %s\n", name,
fdt_strerror(retval));
--
1.6.0.2
- [Qemu-ppc] [PATCH 16/72] ppc: Avoid AREG0 for timebase helpers, (continued)
- [Qemu-ppc] [PATCH 16/72] ppc: Avoid AREG0 for timebase helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 14/72] ppc: Cleanup MMU merge, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 09/72] ppc: Avoid AREG0 for integer and vector helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 17/72] ppc: Split off misc helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 04/72] ppc: Fix coding style in helper.c, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 25/72] booke_206_tlbwe: Discard invalid bits in MAS2, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 23/72] PPC: mpc8544ds: Span initial TLB entry over as much RAM as we need, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 24/72] Avoid segfault in cpu_dump_state, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 28/72] spapr_vscsi: Error handling fixes, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 20/72] ppc: Move load and store helpers, switch to AREG0 free mode, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 31/72] dt: allow add_subnode to create root subnodes,
Alexander Graf <=
- [Qemu-ppc] [PATCH 34/72] dt: temporarily disable subtree creation failure check, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 37/72] dt: add helper for phandle allocation, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 38/72] dt: add helper for 64bit cell adds, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 41/72] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 26/72] ppc64: Rudimentary Support for extra page sizes on server CPUs, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 40/72] PPC: e500: dt: create memory node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 27/72] pseries: Correctly create ibm, segment-page-sizes property, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 06/72] ppc: Split FPU and SPE ops, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 49/72] PPC: e500: dt: create pci node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 56/72] PPC: e500: Use new MPIC dt format, Alexander Graf, 2012/06/23