From patchwork Mon Feb 25 17:08:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15075 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 4954623E24 for ; Mon, 25 Feb 2013 17:09: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 0A68EA18AB8 for ; Mon, 25 Feb 2013 17:09:11 +0000 (UTC) Received: by mail-vc0-f181.google.com with SMTP id f13so1841373vcb.12 for ; Mon, 25 Feb 2013 09:09:11 -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:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=jZapQ/wwJazuVIhZkjhuLHxZ1LZoV7GAChT4SCxiUFY=; b=WrqUSwhv5rx+7APXxY/u8U8QIpDKRVoj1ZjsZE8jwykN1ZYJG7K5pNZ1P8U5CKJCec LHZGAGadz4Yy0dnOEayU80jvhR5ZaDR9eenrxjsQ9Z+gxEtA+FrUm/vi0NZpnnngsCsK pmj0+TkX/2jqWfEtZNjP1L7uAZv5GqxOWIIGruu6xGoGoMrgKBockKylghRdqyRSh5C0 S0XgiWQfizsk5THBm+wfq8YXzR2LI3wxSngBYaQnVRje7vkicFZYf8Gb41Ba9HcmvIpK ODmUVCCxrzjxc9G5X4C5nTKZ7IoPxAHyV+j2izvr2yIQY0PSyq7M8zera/bs9SSnk5Sz QRWw== X-Received: by 10.52.88.237 with SMTP id bj13mr8869047vdb.75.1361812151541; Mon, 25 Feb 2013 09:09: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.58.145.101 with SMTP id st5csp68602veb; Mon, 25 Feb 2013 09:09:10 -0800 (PST) X-Received: by 10.152.125.239 with SMTP id mt15mr10584859lab.26.1361812146622; Mon, 25 Feb 2013 09:09:06 -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 ot5si5476351lab.58.2013.02.25.09.09.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Feb 2013 09:09:06 -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 1UA1Xy-0006w9-DQ; Mon, 25 Feb 2013 17:09:02 +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 v2 1/5] sysbus: make SysBusDeviceClass::init optional Date: Mon, 25 Feb 2013 17:08:58 +0000 Message-Id: <1361812142-26640-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1361812142-26640-1-git-send-email-peter.maydell@linaro.org> References: <1361812142-26640-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQleekTJog22eUNNwV8rRobgF7dH+DikAZwFOYYSA1axDfk668wSAPETa3SYF28YtourDiSm 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 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); }