From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsbHl-0004gR-Vk for qemu-devel@nongnu.org; Thu, 05 Jun 2014 13:17:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsbHf-0007c2-H6 for qemu-devel@nongnu.org; Thu, 05 Jun 2014 13:17:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsbHf-0007bE-6g for qemu-devel@nongnu.org; Thu, 05 Jun 2014 13:16:59 -0400 Date: Thu, 5 Jun 2014 20:17:22 +0300 From: "Michael S. Tsirkin" Message-ID: <1401986505-12359-6-git-send-email-mst@redhat.com> References: <1401986505-12359-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1401986505-12359-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 05/10] 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: Peter Maydell , =?us-ascii?B?PT9VVEYtOD9xP0FuZHJlYXM9MjBGPUMzPUE0cmJlcj89?= , Anthony Liguori From: Andreas F=E4rber This assures the trivial field initialization is applied for any derived type - currently only Q35PCIHost. Signed-off-by: Andreas F=E4rber Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_host.h | 1 - hw/pci-host/q35.c | 4 ---- hw/pci/pcie_host.c | 7 ++++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/hw/pci/pcie_host.h b/include/hw/pci/pcie_host.h index acca45e..ff44ef6 100644 --- a/include/hw/pci/pcie_host.h +++ b/include/hw/pci/pcie_host.h @@ -49,7 +49,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, diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 8b8cc4e..aa48b1c 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -47,10 +47,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 c6e1b57..7c88a1d 100644 --- a/hw/pci/pcie_host.c +++ b/hw/pci/pcie_host.c @@ -83,11 +83,11 @@ static const MemoryRegionOps pcie_mmcfg_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =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) @@ -128,6 +128,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) --=20 MST