Skip to content

Commit

Permalink
pcie_host: Turn pcie_host_init() into an instance_init
Browse files Browse the repository at this point in the history
This assures the trivial field initialization is applied for any derived
type - currently only Q35PCIHost.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
afaerber authored and mstsirkin committed May 21, 2014
1 parent 0d73394 commit 7c8b724
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions hw/pci-host/q35.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions hw/pci/pcie_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion include/hw/pci/pcie_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7c8b724

Please sign in to comment.