qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

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