[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass::initpath |
Date: |
Fri, 23 Nov 2018 09:02:29 +0000 |
On 23 November 2018 at 03:10, maozy <address@hidden> wrote:
> In order to void the subclasses whose parent_realize field is
> set to NULL, the k->realize function must be retained even
> though it doesn't do anything practical. Just like this:
>
>
> -/* TODO remove once all sysbus devices have been converted to realize*/
> static void sysbus_realize(DeviceState *dev, Error **errp)
> {
> - SysBusDevice *sd = SYS_BUS_DEVICE(dev);
> - SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd);
> -
> - if (!sbc->init) {
> - return;
> - }
> - if (sbc->init(sd) < 0) {
> - error_setg(errp, "Device initialization failed");
> - }
> }
>
> it doesn't look elegant, but I didn't think of a better way, if you
> can give me some hints, I really appreciate it. :)
If we do take this approach, we should have a comment which
says why we have an empty realize function, so that we don't
in future forget and delete the apparently unnecessary code...
thanks
-- PMM
[Qemu-devel] [PATCH 09/22] input/pl050: Convert sysbus init function to realize function, Mao Zhongyi, 2018/11/19
[Qemu-devel] [PATCH 04/22] core/empty_slot: Convert sysbus init function to realize function, Mao Zhongyi, 2018/11/19
[Qemu-devel] [PATCH 12/22] milkymist-pfpu: Convert sysbus init function to realize function, Mao Zhongyi, 2018/11/19
[Qemu-devel] [PATCH 11/22] milkymist-hpdmc: Convert sysbus init function to realize function, Mao Zhongyi, 2018/11/19