[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/10] pcie_host: Turn pcie_host_init() into an insta
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 05/10] pcie_host: Turn pcie_host_init() into an instance_init |
Date: |
Thu, 5 Jun 2014 20:17:22 +0300 |
From: Andreas Färber <address@hidden>
This assures the trivial field initialization is applied for any derived
type - currently only Q35PCIHost.
Signed-off-by: Andreas Färber <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
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;
};
-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);
- if (pcie_host_init(PCIE_HOST_BRIDGE(s)) < 0) {
- error_setg(errp, "failed to initialize pcie host");
- return;
- }
pci->bus = pci_bus_new(DEVICE(s), "pcie.0",
s->mch.pci_address_space, s->mch.address_space_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 = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-int pcie_host_init(PCIExpressHost *e)
+static void pcie_host_init(Object *obj)
{
- e->base_addr = PCIE_BASE_ADDR_UNMAPPED;
+ PCIExpressHost *e = PCIE_HOST_BRIDGE(obj);
- return 0;
+ e->base_addr = PCIE_BASE_ADDR_UNMAPPED;
}
void pcie_host_mmcfg_unmap(PCIExpressHost *e)
@@ -128,6 +128,7 @@ static const TypeInfo pcie_host_type_info = {
.parent = TYPE_PCI_HOST_BRIDGE,
.abstract = true,
.instance_size = sizeof(PCIExpressHost),
+ .instance_init = pcie_host_init,
};
static void pcie_host_register_types(void)
--
MST
- [Qemu-devel] [PULL 00/10] pc,pci,virtio,qdev fixes, tests, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 02/10] SMBIOS: Fix endian-ness when populating multi-byte fields, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 01/10] serial-pci: Set prog interface field of pci config to 16550 compatible, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 03/10] SMBIOS: Update Type 0 struct generator for machines >= 2.1, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 04/10] SMBIOS: Fix type 17 field sizes, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 05/10] pcie_host: Turn pcie_host_init() into an instance_init,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 06/10] virtio-balloon: return empty data when no stats are available, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 07/10] tests: rename acpi-test to bios-tables-test, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 09/10] qdev: Display warning about unused -global, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 10/10] qdev: Add test of qdev_prop_check_global, Michael S. Tsirkin, 2014/06/05
- [Qemu-devel] [PULL 08/10] tests: add smbios testing, Michael S. Tsirkin, 2014/06/05
- Re: [Qemu-devel] [PULL 00/10] pc,pci,virtio,qdev fixes, tests, Peter Maydell, 2014/06/05