mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -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
|
@ -186,11 +186,11 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t v
|
|||
if (val & (UNPLUG_IDE_SCSI_DISKS | UNPLUG_AUX_IDE_DISKS |
|
||||
UNPLUG_NVME_DISKS)) {
|
||||
DPRINTF("unplug disks\n");
|
||||
pci_unplug_disks(pci_dev->bus, val);
|
||||
pci_unplug_disks(pci_get_bus(pci_dev), val);
|
||||
}
|
||||
if (val & UNPLUG_ALL_NICS) {
|
||||
DPRINTF("unplug nics\n");
|
||||
pci_unplug_nics(pci_dev->bus);
|
||||
pci_unplug_nics(pci_get_bus(pci_dev));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -372,17 +372,17 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
|
|||
* If VMDP was to control both disk and LAN it would use 4.
|
||||
* If it controlled just disk or just LAN, it would use 8 below.
|
||||
*/
|
||||
pci_unplug_disks(pci_dev->bus, UNPLUG_IDE_SCSI_DISKS);
|
||||
pci_unplug_nics(pci_dev->bus);
|
||||
pci_unplug_disks(pci_get_bus(pci_dev), UNPLUG_IDE_SCSI_DISKS);
|
||||
pci_unplug_nics(pci_get_bus(pci_dev));
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
switch (val) {
|
||||
case 1:
|
||||
pci_unplug_disks(pci_dev->bus, UNPLUG_IDE_SCSI_DISKS);
|
||||
pci_unplug_disks(pci_get_bus(pci_dev), UNPLUG_IDE_SCSI_DISKS);
|
||||
break;
|
||||
case 2:
|
||||
pci_unplug_nics(pci_dev->bus);
|
||||
pci_unplug_nics(pci_get_bus(pci_dev));
|
||||
break;
|
||||
default:
|
||||
log_writeb(s, (uint32_t)val);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue