Message ID | 1020e0bfcfc6e364f967ccb2a9a3778ac174ccbe.1584457537.git.balaton@eik.bme.hu |
---|---|
State | New |
Headers | show |
Series | Misc hw/ide legacy clean up | expand |
On 3/17/20 4:05 PM, BALATON Zoltan wrote: > To avoid any problem with reassigning pci variable store devfn in a > variable instead of acessing it from the PCIDevice. > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> > --- > hw/isa/piix4.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c > index 7edec5e149..2cbdcd7700 100644 > --- a/hw/isa/piix4.c > +++ b/hw/isa/piix4.c > @@ -247,9 +247,10 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, > DriveInfo **hd; > PCIDevice *pci; > DeviceState *dev; > + int devfn = PCI_DEVFN(10, 0); > > - pci = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), > - true, TYPE_PIIX4_PCI_DEVICE); > + pci = pci_create_simple_multifunction(pci_bus, devfn, true, > + TYPE_PIIX4_PCI_DEVICE); > dev = DEVICE(pci); > if (isa_bus) { > *isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); > @@ -257,11 +258,12 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, > > hd = g_new(DriveInfo *, ide_drives); > ide_drive_get(hd, ide_drives); > - pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1); > + pci_piix4_ide_init(pci_bus, hd, devfn + 1); > g_free(hd); > - pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci"); > + > + pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci"); > if (smbus) { > - *smbus = piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100, > + *smbus = piix4_pm_init(pci_bus, devfn + 3, 0x1100, > isa_get_irq(NULL, 9), NULL, 0, NULL); > } > > This looks better, thanks (and sorry for not being more verbose earlier) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Now this looks
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 7edec5e149..2cbdcd7700 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -247,9 +247,10 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, DriveInfo **hd; PCIDevice *pci; DeviceState *dev; + int devfn = PCI_DEVFN(10, 0); - pci = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), - true, TYPE_PIIX4_PCI_DEVICE); + pci = pci_create_simple_multifunction(pci_bus, devfn, true, + TYPE_PIIX4_PCI_DEVICE); dev = DEVICE(pci); if (isa_bus) { *isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); @@ -257,11 +258,12 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, hd = g_new(DriveInfo *, ide_drives); ide_drive_get(hd, ide_drives); - pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1); + pci_piix4_ide_init(pci_bus, hd, devfn + 1); g_free(hd); - pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci"); + + pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci"); if (smbus) { - *smbus = piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100, + *smbus = piix4_pm_init(pci_bus, devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); }
To avoid any problem with reassigning pci variable store devfn in a variable instead of acessing it from the PCIDevice. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> --- hw/isa/piix4.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)