diff options
author | Markus Armbruster | 2020-06-10 07:32:33 +0200 |
---|---|---|
committer | Markus Armbruster | 2020-06-15 22:05:28 +0200 |
commit | 496a8525622d4ac5d276f76840dd30eddb73672d (patch) | |
tree | 0b47f1fcd14bd2efc8ce34a115ee9062008b6c56 /include/hw/sysbus.h | |
parent | sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 2 (diff) | |
download | qemu-496a8525622d4ac5d276f76840dd30eddb73672d.tar.gz qemu-496a8525622d4ac5d276f76840dd30eddb73672d.tar.xz qemu-496a8525622d4ac5d276f76840dd30eddb73672d.zip |
sysbus: New sysbus_realize(), sysbus_realize_and_unref()
Sysbus devices almost always plug into the main system bus.
qdev_create() even has a convenience feature to make that easy: a null
bus argument gets replaced by the main system bus. qdev_realize() and
qdev_realize_and_unref() do the same.
We can do better. Provide convenience wrappers around qdev_realize()
and qdev_realize_and_unref() that don't take a @bus argument. They
always pass the main system bus.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-45-armbru@redhat.com>
Diffstat (limited to 'include/hw/sysbus.h')
-rw-r--r-- | include/hw/sysbus.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index c4a1c0adfa..606095ba35 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -90,6 +90,9 @@ void sysbus_add_io(SysBusDevice *dev, hwaddr addr, MemoryRegion *mem); MemoryRegion *sysbus_address_space(SysBusDevice *dev); +bool sysbus_realize(SysBusDevice *dev, Error **errp); +bool sysbus_realize_and_unref(SysBusDevice *dev, Error **errp); + /** * sysbus_init_child_obj: * @parent: The parent object @@ -121,5 +124,4 @@ static inline DeviceState *sysbus_create_simple(const char *name, return sysbus_create_varargs(name, addr, irq, NULL); } - #endif /* HW_SYSBUS_H */ |