[RFC PATCH 1/5] qdev-properties: Add qdev_property_del_static()

Philippe Mathieu-Daudé posted 5 patches 10 months, 4 weeks ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
[RFC PATCH 1/5] qdev-properties: Add qdev_property_del_static()
Posted by Philippe Mathieu-Daudé 10 months, 4 weeks ago
We can add properties with qdev_property_add_static().
Add qdev_property_del_static() to delete them.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/qdev-properties.h | 2 ++
 hw/core/qdev-properties.c    | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 09aa04ca1e..0e1930177e 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -225,6 +225,8 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
  */
 void qdev_property_add_static(DeviceState *dev, Property *prop);
 
+void qdev_property_del_static(DeviceState *dev, Property *prop);
+
 /**
  * qdev_alias_all_properties: Create aliases on source for all target properties
  * @target: Device which has properties to be aliased
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 7d6fa726fd..0c17a5de82 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -994,6 +994,13 @@ void qdev_property_add_static(DeviceState *dev, Property *prop)
     }
 }
 
+void qdev_property_del_static(DeviceState *dev, Property *prop)
+{
+    Object *obj = OBJECT(dev);
+
+    object_property_del(obj, prop->name);
+}
+
 static void qdev_class_add_property(DeviceClass *klass, const char *name,
                                     Property *prop)
 {
-- 
2.41.0