From nobody Wed Feb 11 04:02:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543572249546920.4788706503972; Fri, 30 Nov 2018 02:04:09 -0800 (PST) Received: from localhost ([::1]:59105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSfeW-0006GR-OL for importer@patchew.org; Fri, 30 Nov 2018 05:04:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSfGn-0006Fn-Gy for qemu-devel@nongnu.org; Fri, 30 Nov 2018 04:39:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSfGm-0002aW-Of for qemu-devel@nongnu.org; Fri, 30 Nov 2018 04:39:33 -0500 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:24233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSfGl-0002Yw-RI for qemu-devel@nongnu.org; Fri, 30 Nov 2018 04:39:32 -0500 Received: from spf.mail.chinamobile.com (unknown[172.16.121.13]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee45c010551a2b-a270f; Fri, 30 Nov 2018 17:39:30 +0800 (CST) Received: from maozy-host.lan (unknown[112.25.154.148]) by rmsmtp-syy-appsvr07-12007 (RichMail) with SMTP id 2ee75c01052eaec-48607; Fri, 30 Nov 2018 17:39:29 +0800 (CST) X-RM-TRANSID: 2ee45c010551a2b-a270f X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee75c01052eaec-48607 From: Mao Zhongyi To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 17:38:52 +0800 Message-Id: <20181130093852.20739-22-maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181130093852.20739-1-maozhongyi@cmss.chinamobile.com> References: <20181130093852.20739-1-maozhongyi@cmss.chinamobile.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 221.176.66.79 Subject: [Qemu-devel] [PATCH v3 21/21] core/sysbus: remove the SysBusDeviceClass::init path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, thuth@redhat.com, ehabkost@redhat.com, Mao Zhongyi , richard.henderson@linaro.org, armbru@redhat.com, alistair.francis@wdc.com, pbonzini@redhat.com, Zhang Shengju Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently, all sysbus devices have been converted to realize(), so remove this path. Cc: ehabkost@redhat.com Cc: thuth@redhat.com Cc: pbonzini@redhat.com Cc: armbru@redhat.com Cc: peter.maydell@linaro.org Cc: richard.henderson@linaro.org Cc: alistair.francis@wdc.com Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju --- hw/core/sysbus.c | 15 +++++---------- include/hw/sysbus.h | 3 --- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 7ac36ad3e7..9f9edbcab9 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -201,18 +201,13 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t = ioport, uint32_t size) } } =20 -/* TODO remove once all sysbus devices have been converted to realize */ +/* The purpose of preserving this empty realize function + * is to prevent the parent_realize field of some subclasses + * from being set to NULL to break the normal init/realize + * of some devices. + */ static void sysbus_realize(DeviceState *dev, Error **errp) { - SysBusDevice *sd =3D SYS_BUS_DEVICE(dev); - SysBusDeviceClass *sbc =3D SYS_BUS_DEVICE_GET_CLASS(sd); - - if (!sbc->init) { - return; - } - if (sbc->init(sd) < 0) { - error_setg(errp, "Device initialization failed"); - } } =20 DeviceState *sysbus_create_varargs(const char *name, diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 0b59a3b8d6..1aedcf05c9 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -38,9 +38,6 @@ typedef struct SysBusDevice SysBusDevice; typedef struct SysBusDeviceClass { /*< private >*/ DeviceClass parent_class; - /*< public >*/ - - int (*init)(SysBusDevice *dev); =20 /* * Let the sysbus device format its own non-PIO, non-MMIO unit address. --=20 2.17.1