qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in


From: Peter Maydell
Subject: Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via
Date: Mon, 9 Mar 2020 09:21:30 +0000

On Mon, 9 Mar 2020 at 00:56, Pan Nengyuan <address@hidden> wrote:
>
>
>
> On 3/8/2020 9:29 PM, Peter Maydell wrote:
> > On Thu, 5 Mar 2020 at 06:39, Pan Nengyuan <address@hidden> wrote:
> >> -    /* Init VIAs 1 and 2 */
> >> -    sysbus_init_child_obj(OBJECT(dev), "via1", &m->mos6522_via1,
> >> -                          sizeof(m->mos6522_via1), 
> >> TYPE_MOS6522_Q800_VIA1);
> >> +    qdev_set_parent_bus(DEVICE(&m->mos6522_via1), sysbus_get_default());
> >> +    qdev_set_parent_bus(DEVICE(&m->mos6522_via2), sysbus_get_default());
> >
> > Rather than manually setting the parent bus, you can use
> > sysbus_init_child_obj() instead of object_initialize_child() --
> > it is a convenience function that does both object_initialize_child()
> > and qdev_set_parent_bus() for you.
>
> Actually I used sysbus_init_child_obj() first, but it will fail to run 
> device-introspect-test.
> Because qdev_set_parent_bus() will change 'info qtree' after we call 
> 'device-list-properties'.
> Thus, I do it in the realize.

Could you explain more? My thought is that we should be using
sysbus_init_child_obj() and we should be doing it in the init method.
Why does that break the tests ? It's the same thing various other
devices do.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]