From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Sergio Lopez" <slp@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
qemu-trivial@nongnu.org,
"Richard Henderson" <richard.henderson@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast()
Date: Tue, 23 May 2023 08:12:05 +0200 [thread overview]
Message-ID: <20230523061207.48818-3-philmd@linaro.org> (raw)
In-Reply-To: <20230523061207.48818-1-philmd@linaro.org>
Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/microvm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 3d606a20b4..7227a2156c 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -389,9 +389,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
bus = sysbus_get_default();
QTAILQ_FOREACH(kid, &bus->children, sibling) {
DeviceState *dev = kid->child;
- ObjectClass *class = object_get_class(OBJECT(dev));
- if (class == object_class_by_name(TYPE_VIRTIO_MMIO)) {
+ if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MMIO)) {
VirtIOMMIOProxy *mmio = VIRTIO_MMIO(OBJECT(dev));
VirtioBusState *mmio_virtio_bus = &mmio->bus;
BusState *mmio_bus = &mmio_virtio_bus->parent_obj;
--
2.38.1
next prev parent reply other threads:[~2023-05-23 6:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 6:12 [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Philippe Mathieu-Daudé
2023-05-23 6:12 ` [PATCH 1/4] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
2023-05-23 18:22 ` Richard Henderson
2023-05-23 6:12 ` Philippe Mathieu-Daudé [this message]
2023-05-23 18:22 ` [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast() Richard Henderson
2023-05-26 8:35 ` Sergio Lopez
2023-05-23 6:12 ` [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
2023-05-23 18:23 ` Richard Henderson
2023-05-23 6:12 ` [PATCH 4/4] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro Philippe Mathieu-Daudé
2023-05-23 18:24 ` Richard Henderson
2023-06-08 18:41 ` [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Michael Tokarev
2023-06-22 20:33 ` Michael S. Tsirkin
2023-06-23 7:00 ` Michael Tokarev
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=20230523061207.48818-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=eduardo@habkost.net \
--cc=kraxel@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=slp@redhat.com \
/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).