From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQ7xp-0007cs-KN for qemu-devel@nongnu.org; Fri, 23 Nov 2018 04:41:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQ7uO-0000PQ-0W for qemu-devel@nongnu.org; Fri, 23 Nov 2018 04:38:00 -0500 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:27968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQ7uN-00008P-6C for qemu-devel@nongnu.org; Fri, 23 Nov 2018 04:37:55 -0500 References: <20181119120820.29878-1-maozhongyi@cmss.chinamobile.com> <20181119120820.29878-23-maozhongyi@cmss.chinamobile.com> <20181119233139.GO3807@habkost.net> From: maozy Message-ID: <73aa2cb6-eb51-c470-5b14-bbf10c3ed0e5@cmss.chinamobile.com> Date: Fri, 23 Nov 2018 17:37:36 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass::initpath List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Eduardo Habkost , QEMU Developers , Thomas Huth , Paolo Bonzini , Markus Armbruster , Richard Henderson , Alistair Francis , Zhang Shengju On 11/23/18 5:02 PM, Peter Maydell wrote: > On 23 November 2018 at 03:10, maozy 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 >