diff mbox series

[06/19] hw/core/gpio: Set QDev properties using QDev API

Message ID 20230203180914.49112-7-philmd@linaro.org
State New
Headers show
Series hw: Set QDev properties using QDev API (part 1/3) | expand

Commit Message

Philippe Mathieu-Daudé Feb. 3, 2023, 6:09 p.m. UTC
No need to use the low-level QOM API when an object
inherits from QDev. Directly use the QDev API to set
its properties.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hw/core/gpio.c b/hw/core/gpio.c
index 80d07a6ec9..ba05dfa92e 100644
--- a/hw/core/gpio.c
+++ b/hw/core/gpio.c
@@ -19,6 +19,7 @@ 
 
 #include "qemu/osdep.h"
 #include "hw/qdev-core.h"
+#include "hw/qdev-properties.h"
 #include "hw/irq.h"
 #include "qapi/error.h"
 
@@ -120,13 +121,12 @@  void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
     char *propname = g_strdup_printf("%s[%d]",
                                      name ? name : "unnamed-gpio-out", n);
     if (input_pin && !OBJECT(input_pin)->parent) {
-        /* We need a name for object_property_set_link to work */
+        /* We need a name for qdev_prop_set_link to work */
         object_property_add_child(container_get(qdev_get_machine(),
                                                 "/unattached"),
                                   "non-qdev-gpio[*]", OBJECT(input_pin));
     }
-    object_property_set_link(OBJECT(dev), propname,
-                             OBJECT(input_pin), &error_abort);
+    qdev_prop_set_link(dev, propname, OBJECT(input_pin));
     g_free(propname);
 }
 
@@ -152,7 +152,7 @@  static qemu_irq qdev_disconnect_gpio_out_named(DeviceState *dev,
     qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
                                                       NULL);
     if (ret) {
-        object_property_set_link(OBJECT(dev), propname, NULL, NULL);
+        qdev_prop_set_link(dev, propname, NULL);
     }
     g_free(propname);
     return ret;