On 31/05/2023 14:52, Philippe Mathieu-Daudé wrote:
> On 31/5/23 14:53, Mark Cave-Ayland wrote:
>> Also change the instantiation of the mac-nubus-bridge device to use
>> object_initialize_child().
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>> hw/m68k/q800.c | 5 ++++-
>> include/hw/m68k/q800.h | 2 ++
>> 2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
>> index f85ccf83af..d02a1a7a1f 100644
>> --- a/hw/m68k/q800.c
>> +++ b/hw/m68k/q800.c
>> @@ -416,7 +416,10 @@ static void q800_machine_init(MachineState *machine)
>> /* NuBus */
>> - dev = qdev_new(TYPE_MAC_NUBUS_BRIDGE);
>> + object_initialize_child(OBJECT(machine), "mac-nubus-bridge",
>> + &m->mac_nubus_bridge,
>> + TYPE_MAC_NUBUS_BRIDGE);
>> + dev = DEVICE(&m->mac_nubus_bridge);
>> qdev_prop_set_uint32(dev, "slot-available-mask",
>> Q800_NUBUS_SLOTS_AVAILABLE);
>> sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
>
> No need to unref(), right?
Ooops yes indeed, I forgot to remove the and_unref().
>> diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h
>> index ce8dbcd68f..3f3e87b3dc 100644
>> --- a/include/hw/m68k/q800.h
>> +++ b/include/hw/m68k/q800.h
>> @@ -30,6 +30,7 @@
>> #include "hw/or-irq.h"
>> #include "hw/scsi/esp.h"
>> #include "hw/block/swim.h"
>> +#include "hw/nubus/mac-nubus-bridge.h"
>> /*
>> * The main Q800 machine
>> @@ -48,6 +49,7 @@ struct Q800MachineState {
>> OrIRQState escc_orgate;
>> SysBusESPState esp;
>> Swim swim;
>> + MacNubusBridge mac_nubus_bridge;
>> MemoryRegion macio;
>> MemoryRegion macio_alias;
>> };
ATB,
Mark.