From patchwork Fri Mar 15 14:34:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15383 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DEE6C23E14 for ; Fri, 15 Mar 2013 14:34:35 +0000 (UTC) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by fiordland.canonical.com (Postfix) with ESMTP id 936A3A1901E for ; Fri, 15 Mar 2013 14:34:35 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id ia10so1276371vcb.8 for ; Fri, 15 Mar 2013 07:34:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=IfF5ylqaAPbbiltPkWJCLjbUm0PTlJp8MKtFRVRdy10=; b=ANm3J8g1X9nJMWmQMrcKeTWvwIAMiRknBf06ZosyEQGTbucNL4HraWmc3IHiuA3oBT Tq5JHftF9g7xMbsgVaLlxxwF0saThY3YzTparIgnCVl6IXbpMgiqXc/IJaYvHVAyMSCJ vjYpnpHj/WjYrIxiM/vO0mIHz+E0hcaaBw/VFvTwq02F2egF/G6AsyTmNsNUZzC3ZOyo gVri/nRkGFX3g6fe3UsSKLSu3BbyTSDhaSB1d2XUn5e7EkBy+fM62LGJzQvHYiwqHbZq GgBUxRVRIwcZMadTzujaVtaf19qpRF9PrfOr8NcVbMPaVQADdqrLK4wxpiGQkigMA5ji s7ag== X-Received: by 10.58.181.201 with SMTP id dy9mr7394700vec.34.1363358075099; Fri, 15 Mar 2013 07:34:35 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp123182veb; Fri, 15 Mar 2013 07:34:34 -0700 (PDT) X-Received: by 10.68.220.68 with SMTP id pu4mr16460368pbc.26.1363358070043; Fri, 15 Mar 2013 07:34:30 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id yf1si10569816pbc.163.2013.03.15.07.34.28 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Mar 2013 07:34:29 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UGViB-0006F8-H2; Fri, 15 Mar 2013 14:34:23 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Walle , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini Subject: [PATCH v3 1/5] sysbus: make SysBusDeviceClass::init optional Date: Fri, 15 Mar 2013 14:34:19 +0000 Message-Id: <1363358063-23973-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1363358063-23973-1-git-send-email-peter.maydell@linaro.org> References: <1363358063-23973-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmmIruDsnx24sFewwP6kgzE2pwXRs5i071beCLzTxl+FKXZBMpRJU+qH/dXlbBKzhdPiAEN Make the SysBusDeviceClass::init optional, for devices which genuinely don't need to do anything here. In particular, simple devices which can do all their initialization in their instance_init method don't need either a DeviceClass::realize or SysBusDeviceClass::init method. Signed-off-by: Peter Maydell Acked-by: Andreas Färber Reviewed-by: Peter Crosthwaite --- hw/sysbus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/sysbus.c b/hw/sysbus.c index 702fc72..9a19468 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -137,6 +137,9 @@ static int sysbus_device_init(DeviceState *dev) SysBusDevice *sd = SYS_BUS_DEVICE(dev); SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd); + if (!sbc->init) { + return 0; + } return sbc->init(sd); }