qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] qdev: change qdev_prop_set_globals() to use Object*


From: Daniel Henrique Barboza
Subject: [PATCH 1/2] qdev: change qdev_prop_set_globals() to use Object*
Date: Wed, 3 Jul 2024 06:46:25 -0300

Next patch will add Accel globals support and will use
qdev_prop_set_globals().

At this moment this function is hardwired to be used with DeviceState.
dev->hotplugged is checked to determine if object_apply_global_props()
will receive a NULL or an &error_fatal errp.

Change qdev_prop_set_globals() to receive an Object and an errp. The
logic using dev->hotplugged is moved to the caller, device_post_init().

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
 hw/core/qdev-properties.c    | 5 ++---
 hw/core/qdev.c               | 2 +-
 include/hw/qdev-properties.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 86a583574d..4867d7dd9e 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -920,10 +920,9 @@ int qdev_prop_check_globals(void)
     return ret;
 }
 
-void qdev_prop_set_globals(DeviceState *dev)
+void qdev_prop_set_globals(Object *obj, Error **errp)
 {
-    object_apply_global_props(OBJECT(dev), global_props(),
-                              dev->hotplugged ? NULL : &error_fatal);
+    object_apply_global_props(obj, global_props(), errp);
 }
 
 /* --- 64bit unsigned int 'size' type --- */
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index f3a996f57d..923f9ca74c 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -673,7 +673,7 @@ static void device_post_init(Object *obj)
      * precedence.
      */
     object_apply_compat_props(obj);
-    qdev_prop_set_globals(DEVICE(obj));
+    qdev_prop_set_globals(obj, DEVICE(obj)->hotplugged ? NULL : &error_fatal);
 }
 
 /* Unlink device from bus and free the structure.  */
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 09aa04ca1e..a1737bf4d8 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -210,7 +210,7 @@ void qdev_prop_register_global(GlobalProperty *prop);
 const GlobalProperty *qdev_find_global_prop(Object *obj,
                                             const char *name);
 int qdev_prop_check_globals(void);
-void qdev_prop_set_globals(DeviceState *dev);
+void qdev_prop_set_globals(Object *obj, Error **errp);
 void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
                                     const char *name, const char *value);
 
-- 
2.45.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]