Message ID | 20240216110313.17039-7-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw: More QDev cleanups | expand |
On Fri, Feb 16, 2024 at 12:02:57PM +0100, Philippe Mathieu-Daudé wrote: > Date: Fri, 16 Feb 2024 12:02:57 +0100 > From: Philippe Mathieu-Daudé <philmd@linaro.org> > Subject: [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() > X-Mailer: git-send-email 2.41.0 > > 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(-) Reviewed-by: Zhao Liu <zhao1.liu@intel.com> > > 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 > >
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);
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(-)