devicetree: Add method to delete property by name

Will be used on Cavium SoC to delete devicetree entries that aren't
available with the board/configuration.

Change-Id: I7c58a2411206bca62d0e96fa627530e937383ac9
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/26693
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index de14c15..2191659 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -763,6 +763,24 @@
 }
 
 /*
+ * Delete a property by name in a given node if it exists.
+ *
+ * @param node		The device tree node to operate on.
+ * @param name		The name of the property to delete.
+ */
+void dt_delete_prop(struct device_tree_node *node, const char *name)
+{
+	struct device_tree_property *prop;
+
+	list_for_each(prop, node->properties, list_node) {
+		if (!strcmp(prop->prop.name, name)) {
+			list_remove(&prop->list_node);
+			return;
+		}
+	}
+}
+
+/*
  * Add an arbitrary property to a node, or update it if it already exists.
  *
  * @param node		The device tree node to add to.