diff mbox

[3/5] device: Add helper to delete a property by name if it exists

Message ID 1476424893-7292-4-git-send-email-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith Oct. 14, 2016, 6:01 a.m. UTC
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

This will be useful for fast reboot which needs to clean a few
things up.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 core/device.c    | 8 ++++++++
 include/device.h | 2 ++
 2 files changed, 10 insertions(+)
diff mbox

Patch

diff --git a/core/device.c b/core/device.c
index 4fa6a38abb44..63b5df808aea 100644
--- a/core/device.c
+++ b/core/device.c
@@ -581,6 +581,14 @@  const struct dt_property *dt_find_property(const struct dt_node *node,
 	return NULL;
 }
 
+void dt_check_del_prop(struct dt_node *node, const char *name)
+{
+	struct dt_property *p;
+
+	p = __dt_find_property(node, name);
+	if (p)
+		dt_del_property(node, p);
+}
 const struct dt_property *dt_require_property(const struct dt_node *node,
 					      const char *name, int wanted_len)
 {
diff --git a/include/device.h b/include/device.h
index ed4fc460598f..4198a41c1b91 100644
--- a/include/device.h
+++ b/include/device.h
@@ -119,6 +119,8 @@  static inline struct dt_property *dt_add_property_u64(struct dt_node *node,
 
 void dt_del_property(struct dt_node *node, struct dt_property *prop);
 
+void dt_check_del_prop(struct dt_node *node, const char *name);
+
 /* Warning: moves *prop! */
 void dt_resize_property(struct dt_property **prop, size_t len);