[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/17] hw/arm/bcm2835: Use object_initialize() on PL0
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 06/17] hw/arm/bcm2835: Use object_initialize() on PL011State |
Date: |
Fri, 24 May 2019 15:44:36 -0300 |
From: Philippe Mathieu-Daudé <address@hidden>
To be coherent with the other peripherals contained in the
BCM2835PeripheralState structure, directly allocate the PL011State
(instead of using the pl011 uart as a pointer to a SysBusDevice).
Initialize the PL011State with object_initialize() instead of
object_new().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
include/hw/arm/bcm2835_peripherals.h | 2 +-
hw/arm/bcm2835_peripherals.c | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/hw/arm/bcm2835_peripherals.h
b/include/hw/arm/bcm2835_peripherals.h
index 959508d57d..e79c21771f 100644
--- a/include/hw/arm/bcm2835_peripherals.h
+++ b/include/hw/arm/bcm2835_peripherals.h
@@ -38,7 +38,7 @@ typedef struct BCM2835PeripheralState {
MemoryRegion ram_alias[4];
qemu_irq irq, fiq;
- SysBusDevice *uart0;
+ PL011State uart0;
BCM2835AuxState aux;
BCM2835FBState fb;
BCM2835DMAState dma;
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
index 7ffb51b692..2931a82a25 100644
--- a/hw/arm/bcm2835_peripherals.c
+++ b/hw/arm/bcm2835_peripherals.c
@@ -46,9 +46,9 @@ static void bcm2835_peripherals_init(Object *obj)
qdev_set_parent_bus(DEVICE(&s->ic), sysbus_get_default());
/* UART0 */
- s->uart0 = SYS_BUS_DEVICE(object_new(TYPE_PL011));
- object_property_add_child(obj, "uart0", OBJECT(s->uart0), NULL);
- qdev_set_parent_bus(DEVICE(s->uart0), sysbus_get_default());
+ object_initialize(&s->uart0, sizeof(s->uart0), TYPE_PL011);
+ object_property_add_child(obj, "uart0", OBJECT(&s->uart0), NULL);
+ qdev_set_parent_bus(DEVICE(&s->uart0), sysbus_get_default());
/* AUX / UART1 */
object_initialize(&s->aux, sizeof(s->aux), TYPE_BCM2835_AUX);
@@ -166,16 +166,16 @@ static void bcm2835_peripherals_realize(DeviceState *dev,
Error **errp)
sysbus_pass_irq(SYS_BUS_DEVICE(s), SYS_BUS_DEVICE(&s->ic));
/* UART0 */
- qdev_prop_set_chr(DEVICE(s->uart0), "chardev", serial_hd(0));
- object_property_set_bool(OBJECT(s->uart0), true, "realized", &err);
+ qdev_prop_set_chr(DEVICE(&s->uart0), "chardev", serial_hd(0));
+ object_property_set_bool(OBJECT(&s->uart0), true, "realized", &err);
if (err) {
error_propagate(errp, err);
return;
}
memory_region_add_subregion(&s->peri_mr, UART0_OFFSET,
- sysbus_mmio_get_region(s->uart0, 0));
- sysbus_connect_irq(s->uart0, 0,
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart0), 0));
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart0), 0,
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
INTERRUPT_UART));
/* AUX / UART1 */
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-devel] [PULL 00/17] Machine Core queue, 2019-05-24, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 01/17] qom/object: Display more helpful message when an object type is missing, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 02/17] hw/ppc/pnv: Use object_initialize_child for correct reference counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 03/17] hw/misc/macio: Use object_initialize_child for correct ref. counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 04/17] hw/virtio: Use object_initialize_child for correct reference counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 05/17] hw/arm/bcm2835: Use TYPE_PL011 instead of hardcoded string, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 06/17] hw/arm/bcm2835: Use object_initialize() on PL011State,
Eduardo Habkost <=
- [Qemu-devel] [PULL 07/17] hw/arm/bcm2835: Use object_initialize_child for correct ref. counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 08/17] hw/arm/aspeed: Use object_initialize_child for correct ref. counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 09/17] hw/arm: Use object_initialize_child for correct reference counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 10/17] hw/mips: Use object_initialize() on MIPSCPSState, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 12/17] hw/microblaze/zynqmp: Move the IPI state into the PMUSoC state, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 11/17] hw/mips: Use object_initialize_child for correct reference counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 14/17] hw/microblaze/zynqmp: Use object_initialize_child for correct ref. counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 13/17] hw/microblaze/zynqmp: Let the SoC manage the IPI devices, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 15/17] hw/microblaze/zynqmp: Use object_initialize_child for correct ref. counting, Eduardo Habkost, 2019/05/24
- [Qemu-devel] [PULL 16/17] hw/arm/mps2: Use object_initialize_child for correct reference counting, Eduardo Habkost, 2019/05/24