From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Fam Zheng <fam@euphon.net>, qemu-s390x <qemu-s390x@nongnu.org>,
Dmitry Fleytman <dmitry.fleytman@gmail.com>,
Alex Williamson <alex.williamson@redhat.com>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
QEMU Trivial <qemu-trivial@nongnu.org>,
David Hildenbrand <david@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Markus Armbruster <armbru@redhat.com>,
Halil Pasic <pasic@linux.ibm.com>,
Aleksandar Rikalo <arikalo@wavecomp.com>,
Michael Walle <michael@walle.cc>,
Gerd Hoffmann <kraxel@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 06/10] hw/audio/ac97: Use the QOM DEVICE() macro to access DeviceState.qdev
Date: Tue, 28 May 2019 17:46:06 +0100 [thread overview]
Message-ID: <CAFEAcA-eGUW096e2Y6vinPHvF74ogwXBaP+orxYEoRhB-mhGFw@mail.gmail.com> (raw)
In-Reply-To: <20190528164020.32250-7-philmd@redhat.com>
On Tue, 28 May 2019 at 17:42, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Rather than looking inside the definition of a DeviceState with
> "s->qdev", use the QOM prefered style: "DEVICE(s)".
>
> This patch was generated using the following Coccinelle script
> (with a bit of manual fix-up, removing an extra space to please
> checkpatch.pl):
>
> // Use DEVICE() macros to access DeviceState.qdev
> @use_device_macro_to_access_qdev@
> expression obj;
> identifier dev;
> @@
> -&obj->dev.qdev
> +DEVICE(obj)
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/audio/ac97.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
> index 2265622d44..a4e8d99e77 100644
> --- a/hw/audio/ac97.c
> +++ b/hw/audio/ac97.c
> @@ -1388,7 +1388,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
> pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
> pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
> AUD_register_card ("ac97", &s->card);
> - ac97_on_reset (&s->dev.qdev);
> + ac97_on_reset(DEVICE(s));
> }
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>.
As an aside, this function has a lot of uses of "&s->dev" to
get the PCIDevice* given an AC97LinkState*. This isn't
necessary as the function has been passed the PCIDevice*
as its argument, so all the uses of "&s->dev" here could
just be written as "dev".
thanks
-- PMM
next prev parent reply other threads:[~2019-05-28 16:57 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 16:40 [Qemu-devel] [PATCH v2 00/10] qom: Use BUS()/DEVICE() macros instead of looking inside definitions Philippe Mathieu-Daudé
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 01/10] hw/scsi/vmw_pvscsi: Use qbus_reset_all() directly Philippe Mathieu-Daudé
2019-06-02 7:02 ` Dmitry Fleytman
2019-06-06 9:29 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 02/10] hw/scsi: Use the QOM BUS() macro to access BusState.qbus Philippe Mathieu-Daudé
2019-06-06 9:41 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-06-06 9:54 ` Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 03/10] hw/pci-bridge: " Philippe Mathieu-Daudé
2019-05-28 16:52 ` Marcel Apfelbaum
2019-06-06 9:31 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 04/10] hw/s390x/event-facility: " Philippe Mathieu-Daudé
2019-05-28 17:00 ` Cornelia Huck
2019-06-06 9:32 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 05/10] hw/sd: " Philippe Mathieu-Daudé
2019-05-28 16:47 ` Peter Maydell
2019-06-06 9:38 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 06/10] hw/audio/ac97: Use the QOM DEVICE() macro to access DeviceState.qdev Philippe Mathieu-Daudé
2019-05-28 16:46 ` Peter Maydell [this message]
2019-06-06 9:36 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 07/10] hw/isa: " Philippe Mathieu-Daudé
2019-05-28 16:53 ` Marcel Apfelbaum
2019-06-06 9:33 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 08/10] hw/usb-storage: " Philippe Mathieu-Daudé
2019-05-29 5:02 ` Gerd Hoffmann
2019-06-06 9:34 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 09/10] hw/vfio/pci: " Philippe Mathieu-Daudé
2019-06-03 18:56 ` Alex Williamson
2019-06-06 9:39 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-05-28 16:40 ` [Qemu-devel] [PATCH v2 10/10] hw/watchdog/wdt_i6300esb: Use " Philippe Mathieu-Daudé
2019-06-06 9:42 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2019-06-06 9:55 ` Laurent Vivier
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=CAFEAcA-eGUW096e2Y6vinPHvF74ogwXBaP+orxYEoRhB-mhGFw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=fam@euphon.net \
--cc=kraxel@redhat.com \
--cc=michael@walle.cc \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=qemu-trivial@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).