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: maozy
Subject: Re: [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass::initpath
Date: Fri, 23 Nov 2018 17:37:36 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0



On 11/23/18 5:02 PM, Peter Maydell wrote:
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...


OK, I got you, will do it.

Thanks,
Mao

thanks
-- PMM






reply via email to

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