OSDN Git Service

pci: Simplify pci_bus_is_root()
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 24 Apr 2019 04:19:58 +0000 (14:19 +1000)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 20 May 2019 22:40:02 +0000 (18:40 -0400)
commitb0e5196a52248d7e4eef709481c1c530c1bca6df
tree6008b4126f8c073bf311599a4b7ea99fbf650dbf
parentc76efd7225d33b48f7a1dd4519620f0b50267612
pci: Simplify pci_bus_is_root()

pci_bus_is_root() currently relies on a method in the PCIBusClass.
But it's always known if a PCI bus is a root bus when we create it, so
using a dynamic method is overkill.

This replaces it with an IS_ROOT bit in a new flags field, which is set on
root buses and otherwise clear.  As a bonus this removes the special
is_root logic from pci_expander_bridge, since it already creates its bus
as a root bus.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <20190424041959.4087-3-david@gibson.dropbear.id.au>
hw/pci-bridge/pci_expander_bridge.c
hw/pci/pci.c
hw/virtio/virtio-pci.c
include/hw/pci/pci.h
include/hw/pci/pci_bus.h