[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] Introduce qemu_fdt_remove_compatible()
From: |
Pavel Fedin |
Subject: |
[Qemu-devel] [PATCH 1/2] Introduce qemu_fdt_remove_compatible() |
Date: |
Wed, 24 Jun 2015 14:58:08 +0300 |
Useful for removing devices from the tree
Signed-off-by: Pavel Fedin <address@hidden>
---
device_tree.c | 10 ++++++++++
include/sysemu/device_tree.h | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/device_tree.c b/device_tree.c
index d2de580..f666df4 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -350,3 +350,13 @@ out:
g_free(propcells);
return ret;
}
+
+void qemu_fdt_remove_compatible(void *fdt, const char *compatible)
+{
+ int offset = fdt_node_offset_by_compatible(fdt, 0, compatible);
+
+ while (offset >= 0) {
+ fdt_nop_node(fdt, offset);
+ offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
+ }
+}
diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h
index 359e143..957df9a 100644
--- a/include/sysemu/device_tree.h
+++ b/include/sysemu/device_tree.h
@@ -110,6 +110,16 @@ int qemu_fdt_setprop_sized_cells_from_array(void *fdt,
qdt_tmp); \
})
+/**
+ * qemu_fdt_remove_compatible:
+ * @fdt: device tree blob
+ * @compatible: value of "compatible" property (one of)
+ *
+ * Removes from the device tree all nodes whose "compatible" property
+ * matches the specified value.
+ */
+void qemu_fdt_remove_compatible(void *fdt, const char *compatible);
+
#define FDT_PCI_RANGE_RELOCATABLE 0x80000000
#define FDT_PCI_RANGE_PREFETCHABLE 0x40000000
#define FDT_PCI_RANGE_ALIASED 0x20000000
--
1.9.5.msysgit.0