From: "Michael S. Tsirkin" <mst@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
qemu-block@nongnu.org, John Snow <jsnow@redhat.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, hpoussin@reactos.org,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Paolo Bonzini <pbonzini@redhat.com>,
philmd@redhat.com, Artyom Tarasenko <atar4qemu@gmail.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 2/8] hw/ide: Get rid of piix4_init function
Date: Sun, 15 Mar 2020 01:35:02 -0400 [thread overview]
Message-ID: <20200315013319-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <3240656814c804513de08bdbbf318f2f590df241.1584134074.git.balaton@eik.bme.hu>
On Fri, Mar 13, 2020 at 10:14:34PM +0100, BALATON Zoltan wrote:
> This removes pci_piix4_ide_init() function similar to clean up done to
> other ide devices.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/ide/piix.c | 12 +-----------
> hw/isa/piix4.c | 5 ++++-
> include/hw/ide.h | 1 -
> 3 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> index 8bcd6b72c2..3b2de4c312 100644
> --- a/hw/ide/piix.c
> +++ b/hw/ide/piix.c
> @@ -208,17 +208,6 @@ static void pci_piix_ide_exitfn(PCIDevice *dev)
> }
> }
>
> -/* hd_table must contain 4 block drivers */
> -/* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */
> -PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
> -{
> - PCIDevice *dev;
> -
> - dev = pci_create_simple(bus, devfn, "piix4-ide");
> - pci_ide_create_devs(dev, hd_table);
> - return dev;
> -}
> -
> /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */
> static void piix3_ide_class_init(ObjectClass *klass, void *data)
> {
> @@ -247,6 +236,7 @@ static const TypeInfo piix3_ide_xen_info = {
> .class_init = piix3_ide_class_init,
> };
>
> +/* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */
> static void piix4_ide_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
> index 7edec5e149..0ab4787658 100644
> --- a/hw/isa/piix4.c
> +++ b/hw/isa/piix4.c
> @@ -35,6 +35,7 @@
> #include "hw/timer/i8254.h"
> #include "hw/rtc/mc146818rtc.h"
> #include "hw/ide.h"
> +#include "hw/ide/pci.h"
> #include "migration/vmstate.h"
> #include "sysemu/reset.h"
> #include "sysemu/runstate.h"
> @@ -255,10 +256,12 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus,
> *isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0"));
> }
>
> + pci = pci_create_simple(pci_bus, pci->devfn + 1, "piix4-ide");
> hd = g_new(DriveInfo *, ide_drives);
> ide_drive_get(hd, ide_drives);
> - pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1);
> + pci_ide_create_devs(pci, hd);
> g_free(hd);
> +
Why not move pci_create_simple down, and declare a new variable?
- pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1);
+ pci_dev = pci_create_simple(pci_bus, pci->devfn + 1, "piix4-ide");
+ pci_ide_create_devs(pci_dev, hd);
makes it clearer what's going on imho.
> pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci");
> if (smbus) {
> *smbus = piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100,
> diff --git a/include/hw/ide.h b/include/hw/ide.h
> index 883bbaeb9b..21bd8f23f1 100644
> --- a/include/hw/ide.h
> +++ b/include/hw/ide.h
> @@ -12,7 +12,6 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
> DriveInfo *hd0, DriveInfo *hd1);
>
> /* ide-pci.c */
> -PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn);
> int pci_piix3_xen_ide_unplug(DeviceState *dev, bool aux);
>
> /* ide-mmio.c */
> --
> 2.21.1
next prev parent reply other threads:[~2020-03-15 5:36 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 21:14 [PATCH 0/8] Misc hw/ide legacy clean up BALATON Zoltan
2020-03-13 21:14 ` [PATCH 6/8] hw/ide: Do ide_drive_get() within pci_ide_create_devs() BALATON Zoltan
2020-03-13 22:16 ` BALATON Zoltan
2020-03-14 10:01 ` Paolo Bonzini
2020-03-16 6:23 ` Markus Armbruster
2020-03-16 8:30 ` Philippe Mathieu-Daudé
2020-03-16 14:03 ` Markus Armbruster
2020-03-13 21:14 ` [PATCH 4/8] hw/ide: Move MAX_IDE_BUS define to one header BALATON Zoltan
2020-03-16 6:53 ` Markus Armbruster
2020-03-16 8:23 ` Philippe Mathieu-Daudé
2020-03-13 21:14 ` [PATCH 1/8] hw/ide: Get rid of piix3_init functions BALATON Zoltan
2020-03-14 21:59 ` Philippe Mathieu-Daudé
2020-03-16 6:34 ` Markus Armbruster
2020-03-16 12:40 ` BALATON Zoltan
2020-03-13 21:14 ` [PATCH 3/8] hw/ide: Remove now unneded #include "hw/pci/pci.h" from hw/ide.h BALATON Zoltan
2020-03-14 22:03 ` Philippe Mathieu-Daudé
2020-03-13 21:14 ` [PATCH 2/8] hw/ide: Get rid of piix4_init function BALATON Zoltan
2020-03-14 22:02 ` Philippe Mathieu-Daudé
2020-03-14 23:52 ` BALATON Zoltan
2020-03-15 5:35 ` Michael S. Tsirkin [this message]
2020-03-15 12:08 ` BALATON Zoltan
2020-03-13 21:14 ` [PATCH 5/8] hw/ide/pci.c: Coding style update to fix checkpatch errors BALATON Zoltan
2020-03-14 22:05 ` Philippe Mathieu-Daudé
2020-03-13 21:14 ` [PATCH 8/8] hw/ide: Remove unneeded inclusion of hw/ide.h BALATON Zoltan
2020-03-13 21:14 ` [PATCH 7/8] hw/ide: Move MAX_IDE_DEVS define to hw/ide/internal.h BALATON Zoltan
2020-03-14 11:45 ` [PATCH 0/8] Misc hw/ide legacy clean up Mark Cave-Ayland
2020-03-14 11:54 ` Paolo Bonzini
2020-03-16 6:58 ` Markus Armbruster
2020-03-16 13:06 ` BALATON Zoltan
2020-03-16 13:41 ` BALATON Zoltan
2020-03-17 4:25 ` John Snow
2020-03-16 12:55 ` [PATCH v2] hw/ide: Move MAX_IDE_DEVS define to hw/ide/internal.h BALATON Zoltan
2020-03-16 13:35 ` [PATCH v2] hw/ide: Do ide_drive_get() within pci_ide_create_devs() BALATON Zoltan
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=20200315013319-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=amarkovic@wavecomp.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=pbonzini@redhat.com \
--cc=philmd@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).