qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Markus Armbruster <armbru@redhat.com>,
	hpoussin@reactos.org,
	Aleksandar Markovic <amarkovic@wavecomp.com>,
	Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>,
	Artyom Tarasenko <atar4qemu@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v3 2/8] hw/isa/piix4.c: Introduce variable to store devfn
Date: Tue, 17 Mar 2020 16:23:17 +0100	[thread overview]
Message-ID: <ad5acdc7-25e6-9a65-3b1d-681edf3aa2f2@redhat.com> (raw)
In-Reply-To: <1020e0bfcfc6e364f967ccb2a9a3778ac174ccbe.1584457537.git.balaton@eik.bme.hu>

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



  reply	other threads:[~2020-03-17 15:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 15:05 [PATCH v3 0/8] Misc hw/ide legacy clean up BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 3/8] hw/ide: Get rid of piix4_init function BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 2/8] hw/isa/piix4.c: Introduce variable to store devfn BALATON Zoltan
2020-03-17 15:23   ` Philippe Mathieu-Daudé [this message]
2020-03-17 15:05 ` [PATCH v3 5/8] hw/ide/pci.c: Coding style update to fix checkpatch errors BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 7/8] hw/ide: Move MAX_IDE_DEVS define to hw/ide/internal.h BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 4/8] hw/ide: Remove now unneded #include "hw/pci/pci.h" from hw/ide.h BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 6/8] hw/ide: Do ide_drive_get() within pci_ide_create_devs() BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 8/8] hw/ide: Remove unneeded inclusion of hw/ide.h BALATON Zoltan
2020-03-17 15:05 ` [PATCH v3 1/8] hw/ide: Get rid of piix3_init functions BALATON Zoltan
2020-03-17 17:53 ` [PATCH v3 0/8] Misc hw/ide legacy clean up John Snow
2020-03-17 18:34   ` BALATON Zoltan
2020-03-17 19:09     ` John Snow
2020-03-17 23:21 ` John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad5acdc7-25e6-9a65-3b1d-681edf3aa2f2@redhat.com \
    --to=philmd@redhat.com \
    --cc=amarkovic@wavecomp.com \
    --cc=armbru@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=ehabkost@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=jsnow@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).