mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
pci: Eliminate redundant PCIDevice::bus pointer
The bus pointer in PCIDevice is basically redundant with QOM information. It's always initialized to the qdev_get_parent_bus(), the only difference is the type. Therefore this patch eliminates the field, instead creating a pci_get_bus() helper to do the type mangling to derive it conveniently from the QOM Device object underneath. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
cdc57472dc
commit
fd56e0612b
20 changed files with 102 additions and 92 deletions
|
@ -155,7 +155,8 @@ pcie_endpoint_cap_common_init(PCIDevice *dev, uint8_t offset, uint8_t cap_size)
|
|||
* a regular Endpoint type is exposed on a root complex. These
|
||||
* should instead be Root Complex Integrated Endpoints.
|
||||
*/
|
||||
if (pci_bus_is_express(dev->bus) && pci_bus_is_root(dev->bus)) {
|
||||
if (pci_bus_is_express(pci_get_bus(dev))
|
||||
&& pci_bus_is_root(pci_get_bus(dev))) {
|
||||
type = PCI_EXP_TYPE_RC_END;
|
||||
}
|
||||
|
||||
|
@ -369,7 +370,7 @@ void pcie_cap_slot_hot_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|||
{
|
||||
uint8_t *exp_cap;
|
||||
PCIDevice *pci_dev = PCI_DEVICE(dev);
|
||||
PCIBus *bus = pci_dev->bus;
|
||||
PCIBus *bus = pci_get_bus(pci_dev);
|
||||
|
||||
pcie_cap_slot_hotplug_common(PCI_DEVICE(hotplug_dev), dev, &exp_cap, errp);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue