diff mbox series

[v2,21/23] q800: move macfb device to Q800MachineState

Message ID 20230531125400.288917-22-mark.cave-ayland@ilande.co.uk (mailing list archive)
State New, archived
Headers show
Series q800: add support for booting MacOS Classic - part 1 | expand

Commit Message

Mark Cave-Ayland May 31, 2023, 12:53 p.m. UTC
Also change the instantiation of the macfb device to use object_initialize_child().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/m68k/q800.c         | 6 ++++--
 include/hw/m68k/q800.h | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé May 31, 2023, 1:55 p.m. UTC | #1
On 31/5/23 14:53, Mark Cave-Ayland wrote:
> Also change the instantiation of the macfb device to use object_initialize_child().
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/m68k/q800.c         | 6 ++++--
>   include/hw/m68k/q800.h | 2 ++
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
> index 946cb09e30..0e7451e77a 100644
> --- a/hw/m68k/q800.c
> +++ b/hw/m68k/q800.c
> @@ -449,7 +449,9 @@ static void q800_machine_init(MachineState *machine)
>   
>       /* framebuffer in nubus slot #9 */
>   
> -    dev = qdev_new(TYPE_NUBUS_MACFB);
> +    object_initialize_child(OBJECT(machine), "macfb", &m->macfb,

Alternatively "framebuffer" or "fb". Regardless,

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +                            TYPE_NUBUS_MACFB);
Mark Cave-Ayland June 3, 2023, 8:32 p.m. UTC | #2
On 31/05/2023 14:55, Philippe Mathieu-Daudé wrote:

> On 31/5/23 14:53, Mark Cave-Ayland wrote:
>> Also change the instantiation of the macfb device to use object_initialize_child().
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>   hw/m68k/q800.c         | 6 ++++--
>>   include/hw/m68k/q800.h | 2 ++
>>   2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
>> index 946cb09e30..0e7451e77a 100644
>> --- a/hw/m68k/q800.c
>> +++ b/hw/m68k/q800.c
>> @@ -449,7 +449,9 @@ static void q800_machine_init(MachineState *machine)
>>       /* framebuffer in nubus slot #9 */
>> -    dev = qdev_new(TYPE_NUBUS_MACFB);
>> +    object_initialize_child(OBJECT(machine), "macfb", &m->macfb,
> 
> Alternatively "framebuffer" or "fb". Regardless,

I'd prefer to keep this as macfb if possible, simply because it matches the 
convention of using the device type as the basis for the object child property name 
throughout the series.

> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
>> +                            TYPE_NUBUS_MACFB);


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 946cb09e30..0e7451e77a 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -449,7 +449,9 @@  static void q800_machine_init(MachineState *machine)
 
     /* framebuffer in nubus slot #9 */
 
-    dev = qdev_new(TYPE_NUBUS_MACFB);
+    object_initialize_child(OBJECT(machine), "macfb", &m->macfb,
+                            TYPE_NUBUS_MACFB);
+    dev = DEVICE(&m->macfb);
     qdev_prop_set_uint32(dev, "slot", 9);
     qdev_prop_set_uint32(dev, "width", graphic_width);
     qdev_prop_set_uint32(dev, "height", graphic_height);
@@ -459,7 +461,7 @@  static void q800_machine_init(MachineState *machine)
     } else {
         qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_VGA);
     }
-    qdev_realize_and_unref(dev, BUS(nubus), &error_fatal);
+    qdev_realize(dev, BUS(nubus), &error_fatal);
 
     macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;
 
diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h
index 3f3e87b3dc..48d2443d74 100644
--- a/include/hw/m68k/q800.h
+++ b/include/hw/m68k/q800.h
@@ -31,6 +31,7 @@ 
 #include "hw/scsi/esp.h"
 #include "hw/block/swim.h"
 #include "hw/nubus/mac-nubus-bridge.h"
+#include "hw/display/macfb.h"
 
 /*
  * The main Q800 machine
@@ -50,6 +51,7 @@  struct Q800MachineState {
     SysBusESPState esp;
     Swim swim;
     MacNubusBridge mac_nubus_bridge;
+    MacfbNubusState macfb;
     MemoryRegion macio;
     MemoryRegion macio_alias;
 };