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: 222985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F9692C0295 for ; Tue, 26 Feb 2013 04:53:40 +1100 (EST) Received: from localhost ([::1]:55727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UA1c2-0005Pb-Ct for incoming@patchwork.ozlabs.org; Mon, 25 Feb 2013 12:13:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UA1bP-00049m-AD for qemu-devel@nongnu.org; Mon, 25 Feb 2013 12:12:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UA1bF-00034X-6Q for qemu-devel@nongnu.org; Mon, 25 Feb 2013 12:12:35 -0500 Received: from 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]:60635 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UA1bE-000341-Vq for qemu-devel@nongnu.org; Mon, 25 Feb 2013 12:12:25 -0500 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 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-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Paolo Bonzini , Michael Walle , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.org Subject: [Qemu-devel] [PATCH v2 1/5] sysbus: make SysBusDeviceClass::init optional X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); }