Message ID | 20230523061207.48818-3-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw: Minor simplifications using proper QOM getter macros | expand |
On 5/22/23 23:12, Philippe Mathieu-Daudé wrote: > 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(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On Tue, May 23, 2023 at 08:12:05AM +0200, Philippe Mathieu-Daudé wrote: > 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(-) Reviewed-by: Sergio Lopez <slp@redhat.com>
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;
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(-)