From ce7243986fe69be831ec893127282fa5a045c985 Mon Sep 17 00:00:00 2001 From: Hu Tao Date: Mon, 1 Jul 2013 18:18:17 +0800 Subject: sysbus: Document SysBusDeviceClass::init and realize semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hu Tao [AF: Syntax and wording changes] Signed-off-by: Andreas Färber --- include/hw/sysbus.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 7c2e316..8c17165 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -23,8 +23,20 @@ typedef struct SysBusDevice SysBusDevice; #define SYS_BUS_DEVICE_GET_CLASS(obj) \ OBJECT_GET_CLASS(SysBusDeviceClass, (obj), TYPE_SYS_BUS_DEVICE) +/** + * SysBusDeviceClass: + * @init: Callback function invoked when the #DeviceState.realized property + * is changed to %true. Deprecated, new types inheriting directly from + * TYPE_SYS_BUS_DEVICE should use #DeviceClass.realize instead, new leaf + * types should consult their respective parent type. + * + * SysBusDeviceClass is not overriding #DeviceClass.realize, so derived + * classes overriding it are not required to invoke its implementation. + */ typedef struct SysBusDeviceClass { + /*< private >*/ DeviceClass parent_class; + /*< public >*/ int (*init)(SysBusDevice *dev); } SysBusDeviceClass; -- cgit v1.1 From ce88812f576a0d5b172f99b253bcdc1dc37f86f2 Mon Sep 17 00:00:00 2001 From: Hu Tao Date: Mon, 1 Jul 2013 18:18:22 +0800 Subject: q35: Use type-safe cast instead of direct access of parent dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And remove variables if possible. Signed-off-by: Hu Tao [AF: Converted remaining access and renamed to parent_obj] Signed-off-by: Andreas Färber --- include/hw/pci-host/q35.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index b083831..3cb631e 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -43,7 +43,10 @@ OBJECT_CHECK(MCHPCIState, (obj), TYPE_MCH_PCI_DEVICE) typedef struct MCHPCIState { - PCIDevice d; + /*< private >*/ + PCIDevice parent_obj; + /*< public >*/ + MemoryRegion *ram_memory; MemoryRegion *pci_address_space; MemoryRegion *system_memory; @@ -59,7 +62,10 @@ typedef struct MCHPCIState { } MCHPCIState; typedef struct Q35PCIHost { - PCIExpressHost host; + /*< private >*/ + PCIExpressHost parent_obj; + /*< public >*/ + MCHPCIState mch; } Q35PCIHost; -- cgit v1.1 From caad4eb345dc5119d326b8af08452cc0f90f8548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 21 Jul 2013 12:16:34 +0200 Subject: scsi: Improve error propagation for scsi_bus_legacy_handle_cmdline() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let scsi_bus_legacy_add_drive() and scsi_bus_legacy_handle_cmdline() return an Error**. Prepare qdev initfns for QOM realize error model. Signed-off-by: Andreas Färber --- include/hw/scsi/scsi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 9786e00..8786531 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -162,8 +162,8 @@ static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d) SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, int unit, bool removable, int bootindex, - const char *serial); -int scsi_bus_legacy_handle_cmdline(SCSIBus *bus); + const char *serial, Error **errp); +void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, Error **errp); /* * Predefined sense codes -- cgit v1.1