[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: |
Tue, 10 Mar 2020 09:41:46 +0000 |
On Tue, 10 Mar 2020 at 09:08, Markus Armbruster <address@hidden> wrote:
> We have >200 calls of sysbus_init_child_obj() in some 40 files. I'm
> arbitrarily picking hw/arm/allwinner-a10.c for a closer look.
>
> It calls it from device allwinner-a10's .instance_init() method
> aw_a10_init(). Side effect, clearly wrong.
Huh. This implies that sysbus_init_child_obj() is a fundamentally
broken API. It bundles up two things: (a) init the child object and
(b) say it is on the sysbus. But (a) should be done in 'init' and (b)
should be done in 'realize'. So that's another line of boilerplate
code needed, plus because "put the thing on the sysbus" has
to be its own call it's easier to forget. That's a shame, as
"this object has a child object" is already pretty boilerplate-heavy,
and now it looks like:
* in init, call object_initialize_chid()
* in realize, call qdev_set_parent_bus()
* in realize, realize child (which is 5 lines of code because
of the "if (err != NULL) { error_propagate(errp, err); return; }")
It's a shame we didn't realize sysbus_init_child_obj() was
fundamentally broken before we did a lot of conversion
of code to use it...
thanks
-- PMM
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, (continued)
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Pan Nengyuan, 2020/03/08
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Peter Maydell, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Pan Nengyuan, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Peter Maydell, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Markus Armbruster, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Pan Nengyuan, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Markus Armbruster, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Mark Cave-Ayland, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Pan Nengyuan, 2020/03/09
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Markus Armbruster, 2020/03/10
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via,
Peter Maydell <=
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, BALATON Zoltan, 2020/03/10
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Mark Cave-Ayland, 2020/03/14
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Paolo Bonzini, 2020/03/14
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Markus Armbruster, 2020/03/15
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Paolo Bonzini, 2020/03/15
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Markus Armbruster, 2020/03/16
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Paolo Bonzini, 2020/03/16
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Markus Armbruster, 2020/03/18
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Paolo Bonzini, 2020/03/18
- Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via, Peter Maydell, 2020/03/18