[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 26/58] device tree: add add_subnode command
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 26/58] device tree: add add_subnode command |
Date: |
Wed, 14 Sep 2011 10:42:50 +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-ppc] [PATCH 20/58] PPC: KVM: Remove kvmppc_read_host_property, (continued)
- [Qemu-ppc] [PATCH 20/58] PPC: KVM: Remove kvmppc_read_host_property, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 32/58] PPC: Add new target config for pseries, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 25/58] PPC: E500: Update cpu-release-addr property in cpu nodes, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 46/58] ppc: booke206: use MAV=2.0 TSIZE definition, fix 4G pages, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 23/58] PPC: E500: Remove unneeded CPU nodes, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 35/58] PPC: SPAPR: Use KVM function for time info, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 49/58] vscsi: send the CHECK_CONDITION status down together with autosense data, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 39/58] pseries: More complete WIMG validation in H_ENTER code, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 30/58] MPC8544DS: Generate CPU nodes on init, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 26/58] device tree: add add_subnode command,
Alexander Graf <=
- [Qemu-ppc] [PATCH 38/58] pseries: interrupt controller should not have a 'reg' property, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 33/58] KVM: update kernel headers, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 31/58] PPC: E500: Bump CPU count to 15, Alexander Graf, 2011/09/14
- [Qemu-ppc] [PATCH 50/58] pseries: Update SLOF firmware image, Alexander Graf, 2011/09/14