[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/64] device tree: add add_subnode command
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 26/64] device tree: add add_subnode command |
Date: |
Thu, 6 Oct 2011 10:05:28 +0200 |
We want to be able to create subnodes in our device tree, so export it through
the qemu device tree abstraction framework.
Signed-off-by: Alexander Graf <address@hidden>
---
device_tree.c | 24 ++++++++++++++++++++++++
device_tree.h | 1 +
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index 23e89e3..f4a78c8 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -118,3 +118,27 @@ int qemu_devtree_nop_node(void *fdt, const char *node_path)
return fdt_nop_node(fdt, offset);
}
+
+int qemu_devtree_add_subnode(void *fdt, const char *name)
+{
+ int offset;
+ char *dupname = g_strdup(name);
+ char *basename = strrchr(dupname, '/');
+ int retval;
+
+ if (!basename) {
+ return -1;
+ }
+
+ basename[0] = '\0';
+ basename++;
+
+ offset = fdt_path_offset(fdt, dupname);
+ if (offset < 0) {
+ return offset;
+ }
+
+ retval = fdt_add_subnode(fdt, offset, basename);
+ g_free(dupname);
+ return retval;
+}
diff --git a/device_tree.h b/device_tree.h
index 76fce5f..4378685 100644
--- a/device_tree.h
+++ b/device_tree.h
@@ -23,5 +23,6 @@ int qemu_devtree_setprop_cell(void *fdt, const char
*node_path,
int qemu_devtree_setprop_string(void *fdt, const char *node_path,
const char *property, const char *string);
int qemu_devtree_nop_node(void *fdt, const char *node_path);
+int qemu_devtree_add_subnode(void *fdt, const char *name);
#endif /* __DEVICE_TREE_H__ */
--
1.6.0.2
- [Qemu-devel] [PATCH 19/64] PPC: bamboo: Use kvm api for freq and clock frequencies, (continued)
- [Qemu-devel] [PATCH 19/64] PPC: bamboo: Use kvm api for freq and clock frequencies, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 11/64] PPC: Bump MPIC up to 32 supported CPUs, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 52/64] openpic: Unfold read_IRQreg, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 14/64] device tree: add nop_node, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 47/64] Implement POWER7's CFAR in TCG, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 42/64] pseries: use macro for firmware filename, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 57/64] KVM: Update kernel headers, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 46/64] ppc: booke206: use MAV=2.0 TSIZE definition, fix 4G pages, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 53/64] openpic: Unfold write_IRQreg, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 54/64] ppc: move ADB stuff from ppc_mac.h to adb.h, Alexander Graf, 2011/10/06
- [Qemu-devel] [PATCH 26/64] device tree: add add_subnode command,
Alexander Graf <=
- [Qemu-devel] [PATCH 39/64] pseries: More complete WIMG validation in H_ENTER code, Alexander Graf, 2011/10/06
- Re: [Qemu-devel] [PULL 00/64] ppc patch queue 2011-10-06, Blue Swirl, 2011/10/08