From patchwork Thu Dec 13 14:54:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 153670 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp912171ljp; Thu, 13 Dec 2018 07:09:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/WoF3IQjo8zHg0OxyAs80qOHDTzt8vN07bg6IzEAex1/07fRPqraHy3sH3rkNrKyZYvgxgY X-Received: by 2002:a37:a942:: with SMTP id s63mr21564290qke.331.1544713779384; Thu, 13 Dec 2018 07:09:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544713779; cv=none; d=google.com; s=arc-20160816; b=jEYvx+A/matLLZvQn9l8kyYwyck5jYjXeFVK9D0fLOrVjFTIlY1SKpS/N6Kr9PQnxI q1VLXMyHS41laKJDVAbGwgMoR/pZZ6y5saIyIJomRE0kXhP7ZOaKjY/TO+o7L4SjlM83 bxJ2kUX3lwW026CJNZbcxcbqJ+Ng5T5xb3xJoqq2r9D0d2EyUut43tbKyabMLwEaIUKS vWmTSo9+cwKVYn4s6VpCAKogEhWZIPC12gxkjvcDbZyw4nHOa1Ko+tqL0EdcAFvRZhmZ oHlDnGIkll1R3z2MbcXaDOsRh926ligDOYcbE96qiG1Tx6uF1uxm4hga2P/z2dQgl0/a vB/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=ISlnx0tOOeUGpWkgrfjbD0R+QX4AoUXoXztXmMfA20E=; b=lInnqFbfcMiA9ci06rAK5Vg0p7geU7ePswmK+fnzArlzQgnZJGHNl6/pW4AVnJcJKr Q+WZ1gMlpU60zCy4Muz6CNJSl5mec/Glxz+4YjxYeiGr/x6719PhvTR0WSXC9c9akqh7 QOmXj/YO8mFPQvcVmMlrGAJbRq7/T9wUyyPSzEdAo5YN3xnhfeiRTTqBdv7U4H7fxi4T czha7nmpVajYYczp9ZJWo1iY55OHP4CqsxePZBF5E4ucTJxZQtWRuQC0LGu86G18WPWv iTjWdiZVnWmichlHZAb4LZRxLFB5xzJeIoH1Rtu+Oyon6mGH17Bv5sn0RUF/wce5DZ76 m8ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r2si1163648qvn.10.2018.12.13.07.09.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Dec 2018 07:09:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXScL-0000Hq-I2 for patch@linaro.org; Thu, 13 Dec 2018 10:09:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXSP7-000541-Jk for qemu-devel@nongnu.org; Thu, 13 Dec 2018 09:55:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXSP6-0008Us-HR for qemu-devel@nongnu.org; Thu, 13 Dec 2018 09:55:57 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:53506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXSP6-0006zA-8Q for qemu-devel@nongnu.org; Thu, 13 Dec 2018 09:55:56 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gXSOA-0007Ke-B8 for qemu-devel@nongnu.org; Thu, 13 Dec 2018 14:54:58 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 14:54:31 +0000 Message-Id: <20181213145445.17935-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181213145445.17935-1-peter.maydell@linaro.org> References: <20181213145445.17935-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 23/37] 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mao Zhongyi 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 Message-id: 20181130093852.20739-22-maozhongyi@cmss.chinamobile.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/sysbus.h | 3 --- hw/core/sysbus.c | 15 +++++---------- 2 files changed, 5 insertions(+), 13 deletions(-) -- 2.19.2 diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 0b59a3b8d60..1aedcf05c92 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); /* * Let the sysbus device format its own non-PIO, non-MMIO unit address. diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 7ac36ad3e70..9f9edbcab96 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) } } -/* 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 = 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"); - } } DeviceState *sysbus_create_varargs(const char *name,