summaryrefslogtreecommitdiffstats
path: root/hw/misc/macio/pmu.c
diff options
context:
space:
mode:
authorPeter Maydell2020-06-16 12:48:22 +0200
committerPeter Maydell2020-06-16 12:48:23 +0200
commit6675a653d2e57ab09c32c0ea7b44a1d6c40a7f58 (patch)
treef111fb308c19e2b4f2dd8b8482e057b4f3490362 /hw/misc/macio/pmu.c
parentMerge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-jun-15-2020' ... (diff)
parentMAINTAINERS: Make section QOM cover hw/core/*bus.c as well (diff)
downloadqemu-6675a653d2e57ab09c32c0ea7b44a1d6c40a7f58.tar.gz
qemu-6675a653d2e57ab09c32c0ea7b44a1d6c40a7f58.tar.xz
qemu-6675a653d2e57ab09c32c0ea7b44a1d6c40a7f58.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-qom-2020-06-15' into staging
QOM patches for 2020-06-15 # gpg: Signature made Mon 15 Jun 2020 21:07:19 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qom-2020-06-15: (84 commits) MAINTAINERS: Make section QOM cover hw/core/*bus.c as well qdev: qdev_init_nofail() is now unused, drop qdev: Convert bus-less devices to qdev_realize() with Coccinelle qdev: Use qdev_realize() in qdev_device_add() qdev: Make qdev_realize() support bus-less devices s390x/event-facility: Simplify creation of SCLP event devices microbit: Eliminate two local variables in microbit_init() sysbus: sysbus_init_child_obj() is now unused, drop sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 4 sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 3 sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 2 sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 1 qdev: Drop qdev_realize() support for null bus sysbus: Convert to sysbus_realize() etc. with Coccinelle sysbus: New sysbus_realize(), sysbus_realize_and_unref() sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 2 hw/arm/armsse: Pass correct child size to sysbus_init_child_obj() sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 1 microbit: Tidy up sysbus_init_child_obj() @child argument sysbus: Drop useless OBJECT() in sysbus_init_child_obj() calls ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc/macio/pmu.c')
-rw-r--r--hw/misc/macio/pmu.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
index 9a9cd427e1..41b626c46c 100644
--- a/hw/misc/macio/pmu.c
+++ b/hw/misc/macio/pmu.c
@@ -38,8 +38,10 @@
#include "hw/misc/mos6522.h"
#include "hw/misc/macio/gpio.h"
#include "hw/misc/macio/pmu.h"
+#include "qapi/error.h"
#include "qemu/timer.h"
#include "sysemu/runstate.h"
+#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/log.h"
#include "qemu/module.h"
@@ -739,16 +741,19 @@ static void pmu_reset(DeviceState *dev)
static void pmu_realize(DeviceState *dev, Error **errp)
{
PMUState *s = VIA_PMU(dev);
+ Error *err = NULL;
SysBusDevice *sbd;
- MOS6522State *ms;
- DeviceState *d;
struct tm tm;
+ sysbus_realize(SYS_BUS_DEVICE(&s->mos6522_pmu), &err);
+ if (err) {
+ 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));
+ sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->mos6522_pmu));
qemu_get_timedate(&tm, 0);
s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
@@ -775,8 +780,8 @@ static void pmu_init(Object *obj)
qdev_prop_allow_set_link_before_realize,
0);
- sysbus_init_child_obj(obj, "mos6522-pmu", &s->mos6522_pmu,
- sizeof(s->mos6522_pmu), TYPE_MOS6522_PMU);
+ object_initialize_child(obj, "mos6522-pmu", &s->mos6522_pmu,
+ TYPE_MOS6522_PMU);
memory_region_init_io(&s->mem, obj, &mos6522_pmu_ops, s, "via-pmu",
0x2000);