[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 3/4] hw/misc/macio: fix incorrect creation of mos6522's subcla
From: |
Pan Nengyuan |
Subject: |
[PATCH v5 3/4] hw/misc/macio: fix incorrect creation of mos6522's subclasses |
Date: |
Sat, 14 Mar 2020 16:47:29 +0800 |
There are two other places where we create mos6522's subclasses but forgot to
realize
it. This patch do the realize in these places to fix that.
Signed-off-by: Pan Nengyuan <address@hidden>
---
Cc: Mark Cave-Ayland <address@hidden>
Cc: David Gibson <address@hidden>
Cc: address@hidden
---
v5:
- Also fix incorrect creation of mos6522's subclasses on two other places.
Not sure if there is a conversion plan, we still keep sysbus_init_child_obj
in init()
in this patch as it was.
---
hw/misc/macio/cuda.c | 11 +++++++++--
hw/misc/macio/pmu.c | 11 +++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index e0cc0aac5d..ee780a8288 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -36,6 +36,7 @@
#include "qemu/cutils.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "qapi/error.h"
#include "trace.h"
/* Bits in B data register: all active low */
@@ -524,11 +525,17 @@ static void cuda_realize(DeviceState *dev, Error **errp)
CUDAState *s = CUDA(dev);
SysBusDevice *sbd;
MOS6522State *ms;
- DeviceState *d;
+ DeviceState *d = DEVICE(&s->mos6522_cuda);
struct tm tm;
+ Error *err = NULL;
+
+ object_property_set_bool(OBJECT(d), true, "realized", &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ return;
+ }
/* Pass IRQ from 6522 */
- d = DEVICE(&s->mos6522_cuda);
ms = MOS6522(d);
sbd = SYS_BUS_DEVICE(s);
sysbus_pass_irq(sbd, SYS_BUS_DEVICE(ms));
diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
index b8466a4a3f..ae55992288 100644
--- a/hw/misc/macio/pmu.c
+++ b/hw/misc/macio/pmu.c
@@ -43,6 +43,7 @@
#include "qemu/cutils.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "qapi/error.h"
#include "trace.h"
@@ -741,11 +742,17 @@ static void pmu_realize(DeviceState *dev, Error **errp)
PMUState *s = VIA_PMU(dev);
SysBusDevice *sbd;
MOS6522State *ms;
- DeviceState *d;
+ DeviceState *d = DEVICE(&s->mos6522_pmu);;
struct tm tm;
+ Error *err = NULL;
+
+ object_property_set_bool(OBJECT(d), true, "realized", &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ return;
+ }
/* Pass IRQ from 6522 */
- d = DEVICE(&s->mos6522_pmu);
ms = MOS6522(d);
sbd = SYS_BUS_DEVICE(s);
sysbus_pass_irq(sbd, SYS_BUS_DEVICE(ms));
--
2.18.2
- [PATCH v5 0/4] delay timer_new from init to realize to fix memleaks., Pan Nengyuan, 2020/03/14
- [PATCH v5 4/4] hw/misc/mos6522: move timer_new from init() into realize() to avoid memleaks, Pan Nengyuan, 2020/03/14
- [PATCH v5 1/4] s390x: fix memleaks in cpu_finalize, Pan Nengyuan, 2020/03/14
- [PATCH v5 2/4] mac_via: fix incorrect creation of mos6522 device in mac_via, Pan Nengyuan, 2020/03/14
- [PATCH v5 3/4] hw/misc/macio: fix incorrect creation of mos6522's subclasses,
Pan Nengyuan <=
- Re: [PATCH v5 0/4] delay timer_new from init to realize to fix memleaks., no-reply, 2020/03/14
- Re: [PATCH v5 0/4] delay timer_new from init to realize to fix memleaks., Mark Cave-Ayland, 2020/03/14