Received: from eggs.gnu.org ([2001:4830:134:3::10]:48046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1R8M-0008Vc-J5 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 21:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1R8K-0004xg-8C for qemu-devel@nongnu.org; Mon, 22 Jul 2013 21:11:22 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47817 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1R8J-0004xa-Uh for qemu-devel@nongnu.org; Mon, 22 Jul 2013 21:11:20 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 03:11:14 +0200 Message-Id: <1374541874-1534-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-next] pcie_host: Turn pcie_host_init() into an instance_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" This assures the trivial field initialization is applied for any derived type - currently only Q35PCIHost. Signed-off-by: Andreas F=C3=A4rber --- hw/pci-host/q35.c | 4 ---- hw/pci/pcie_host.c | 7 ++++--- include/hw/pci/pcie_host.h | 1 - 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 6b1b3b7..f727a29 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -46,10 +46,6 @@ static void q35_host_realize(DeviceState *dev, Error *= *errp) sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem); sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, 4); =20 - if (pcie_host_init(PCIE_HOST_BRIDGE(s)) < 0) { - error_setg(errp, "failed to initialize pcie host"); - return; - } pci->bus =3D pci_bus_new(DEVICE(s), "pcie.0", s->mch.pci_address_space, s->mch.address_spac= e_io, 0, TYPE_PCIE_BUS); diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c index b70e5ad..e1c3cf4 100644 --- a/hw/pci/pcie_host.c +++ b/hw/pci/pcie_host.c @@ -107,11 +107,11 @@ static const MemoryRegionOps pcie_mmcfg_ops =3D { /* pcie_host::base_addr =3D=3D PCIE_BASE_ADDR_UNMAPPED when it isn't map= ped. */ #define PCIE_BASE_ADDR_UNMAPPED ((hwaddr)-1ULL) =20 -int pcie_host_init(PCIExpressHost *e) +static void pcie_host_init(Object *obj) { - e->base_addr =3D PCIE_BASE_ADDR_UNMAPPED; + PCIExpressHost *e =3D PCIE_HOST_BRIDGE(obj); =20 - return 0; + e->base_addr =3D PCIE_BASE_ADDR_UNMAPPED; } =20 void pcie_host_mmcfg_unmap(PCIExpressHost *e) @@ -152,6 +152,7 @@ static const TypeInfo pcie_host_type_info =3D { .parent =3D TYPE_PCI_HOST_BRIDGE, .abstract =3D true, .instance_size =3D sizeof(PCIExpressHost), + .instance_init =3D pcie_host_init, }; =20 static void pcie_host_register_types(void) diff --git a/include/hw/pci/pcie_host.h b/include/hw/pci/pcie_host.h index 1228e36..a1bf3b2 100644 --- a/include/hw/pci/pcie_host.h +++ b/include/hw/pci/pcie_host.h @@ -43,7 +43,6 @@ struct PCIExpressHost { MemoryRegion mmio; }; =20 -int pcie_host_init(PCIExpressHost *e); void pcie_host_mmcfg_unmap(PCIExpressHost *e); void pcie_host_mmcfg_map(PCIExpressHost *e, hwaddr addr, uint32_t size); void pcie_host_mmcfg_update(PCIExpressHost *e, --=20 1.8.1.4