[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [RFC 7/7] pci: Set phb->bus inside pci_bus_new_inplace()
From: |
David Gibson |
Subject: |
Re: [Qemu-arm] [RFC 7/7] pci: Set phb->bus inside pci_bus_new_inplace() |
Date: |
Tue, 18 Apr 2017 13:56:30 +1000 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Mon, Apr 17, 2017 at 06:59:16PM -0300, Eduardo Habkost wrote:
> Every single caller of pci_bus_new_inplace() sets phb->bus to point to
> 'bus'. Do that inside pci_bus_new_inplace() to avoid code duplication
> and make it harder to break.
>
> Cc: "Hervé Poussineau" <address@hidden>
> Cc: Marcel Apfelbaum <address@hidden>
> Cc: "Michael S. Tsirkin" <address@hidden>
> Cc: Peter Maydell <address@hidden>
> Cc: address@hidden
> Cc: address@hidden
> Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> hw/pci-host/prep.c | 2 --
> hw/pci-host/versatile.c | 1 -
> hw/pci/pci.c | 1 +
> 3 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
> index 2e2cd267f4..6efa5bc5ef 100644
> --- a/hw/pci-host/prep.c
> +++ b/hw/pci-host/prep.c
> @@ -284,8 +284,6 @@ static void raven_pcihost_initfn(Object *obj)
> address_space_init(&s->bm_as, &s->bm, "raven-bm");
> pci_setup_iommu(&s->pci_bus, raven_pcihost_set_iommu, s);
>
> - h->bus = &s->pci_bus;
> -
> object_initialize(&s->pci_dev, sizeof(s->pci_dev),
> TYPE_RAVEN_PCI_DEVICE);
> pci_dev = DEVICE(&s->pci_dev);
> qdev_set_parent_bus(pci_dev, BUS(&s->pci_bus));
> diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
> index 24ef87610b..630f1ac1c5 100644
> --- a/hw/pci-host/versatile.c
> +++ b/hw/pci-host/versatile.c
> @@ -389,7 +389,6 @@ static void pci_vpb_init(Object *obj)
> pci_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), h, "pci",
> &s->pci_mem_space, &s->pci_io_space,
> PCI_DEVFN(11, 0), TYPE_PCI_BUS);
> - h->bus = &s->pci_bus;
>
> object_initialize(&s->pci_dev, sizeof(s->pci_dev),
> TYPE_VERSATILE_PCI_HOST);
> qdev_set_parent_bus(DEVICE(&s->pci_dev), BUS(&s->pci_bus));
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 486aeb7514..ef226f8b41 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -397,6 +397,7 @@ void pci_bus_new_inplace(PCIBus *bus, size_t bus_size,
> {
> qbus_create_inplace(bus, bus_size, typename, DEVICE(phb), name);
> pci_bus_init(bus, phb, address_space_mem, address_space_io, devfn_min);
> + phb->bus = bus;
> }
>
> PCIBus *pci_bus_new(PCIHostState *phb, const char *name,
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature