From patchwork Fri Feb 15 11:45:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 14843 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 E198123EAD for ; Fri, 15 Feb 2013 11:45:12 +0000 (UTC) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by fiordland.canonical.com (Postfix) with ESMTP id 9C952A18892 for ; Fri, 15 Feb 2013 11:45:12 +0000 (UTC) Received: by mail-vc0-f181.google.com with SMTP id d16so2133881vcd.12 for ; Fri, 15 Feb 2013 03:45:12 -0800 (PST) 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:x-gm-message-state; bh=LloXn/vnefxI/mPg2CM222BChp/ZyzsaqLwuGFG9Q1E=; b=mzLd94Fd8QNj5kqlBOH+DT7tgqh54szzIiq2Z6EjvF0DYgspsWJ4RUkhDADRkSCMmp DQw32Dzc0DvHa4gk9TDqbqQZ2A+gXQs7NUjHoudCiKtTb/phSYyt+faNUIMtIfE1W2Ur 8d39rLNdj1+J1JaHYfRTRzKas7OTx5fwsfmLv5luaQxf2uekSq2SBnM06o5yHN+yYeog mhv472FPd8VjqKknH43/hJ3DP+ZwzyVM2zZdabKP97jqqfrHKx++GFELEbNOj5wtGmaG 23HK7i3gimGkOEXfz1/3WxO2JykmzfM3rROyJbSvOHb+7cFSzkmhulESQQeGF49viq/l FLsg== X-Received: by 10.220.220.134 with SMTP id hy6mr2737683vcb.2.1360928711911; Fri, 15 Feb 2013 03:45:11 -0800 (PST) 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.221.4.5 with SMTP id oa5csp8009vcb; Fri, 15 Feb 2013 03:45:11 -0800 (PST) X-Received: by 10.14.223.69 with SMTP id u45mr7600638eep.23.1360928708813; Fri, 15 Feb 2013 03:45:08 -0800 (PST) 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 f6si16362625eep.200.2013.02.15.03.45.07 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 03:45:08 -0800 (PST) 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 1U6Jj0-0003Oo-C3; Fri, 15 Feb 2013 11:45:06 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Walle , Jan Kiszka Subject: [PATCH 1/5] sysbus: make SysBusDeviceClass::init optional Date: Fri, 15 Feb 2013 11:45:02 +0000 Message-Id: <1360928706-13041-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1360928706-13041-1-git-send-email-peter.maydell@linaro.org> References: <1360928706-13041-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQnjosLFEgrdppGXJ1kvg59eQBHN/RufUT5kza0TizRtdHq6k9Q6mc8iXI0E0kR3ityZeiAw 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 --- hw/sysbus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/sysbus.c b/hw/sysbus.c index 6d9d1df..e9a16ac 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -118,6 +118,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); }