[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() |
Date: |
Fri, 16 Feb 2024 12:02:57 +0100 |
Prefer QDev API for QDev objects, avoid the underlying QOM layer.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/musicpal.c | 2 +-
hw/core/qdev.c | 2 +-
hw/sparc/sun4m.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 2020f73a57..74e4d24aab 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1238,7 +1238,7 @@ static void musicpal_init(MachineState *machine)
qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
/* Logically OR both UART IRQs together */
- uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ uart_orgate = qdev_new(TYPE_OR_IRQ);
object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
qdev_connect_gpio_out(uart_orgate, 0,
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c68d0f7c51..a271380d20 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -171,7 +171,7 @@ DeviceState *qdev_try_new(const char *name)
if (!module_object_class_by_name(name)) {
return NULL;
}
- return DEVICE(object_new(name));
+ return qdev_new(name);
}
static QTAILQ_HEAD(, DeviceListener) device_listeners
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index d52e6a7213..fedc4b8b3f 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -979,7 +979,7 @@ static void sun4m_hw_init(MachineState *machine)
sysbus_mmio_map(s, 0, hwdef->ms_kb_base);
/* Logically OR both its IRQs together */
- ms_kb_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ ms_kb_orgate = qdev_new(TYPE_OR_IRQ);
object_property_set_int(OBJECT(ms_kb_orgate), "num-lines", 2,
&error_fatal);
qdev_realize_and_unref(ms_kb_orgate, NULL, &error_fatal);
sysbus_connect_irq(s, 0, qdev_get_gpio_in(ms_kb_orgate, 0));
@@ -1000,7 +1000,7 @@ static void sun4m_hw_init(MachineState *machine)
sysbus_mmio_map(s, 0, hwdef->serial_base);
/* Logically OR both its IRQs together */
- serial_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ serial_orgate = qdev_new(TYPE_OR_IRQ);
object_property_set_int(OBJECT(serial_orgate), "num-lines", 2,
&error_fatal);
qdev_realize_and_unref(serial_orgate, NULL, &error_fatal);
--
2.41.0
- Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style, (continued)
- [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 03/21] hw/ppc/spapr_cpu: Use qdev_is_realized() instead of QOM API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new(),
Philippe Mathieu-Daudé <=
- [PATCH 07/21] target: Replace DEVICE(object_new) -> qdev_new(), Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 09/21] hw/usb: Inline usb_try_new(), Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 08/21] hw/isa: Inline isa_try_new(), Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 10/21] hw/usb: Inline usb_new(), Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices, Philippe Mathieu-Daudé, 2024/02/16