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: 228006 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 673B02C00BC for ; Sat, 16 Mar 2013 01:34:50 +1100 (EST) Received: from localhost ([::1]:56204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGVia-0003ya-DV for incoming@patchwork.ozlabs.org; Fri, 15 Mar 2013 10:34:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGViI-0003xM-VJ for qemu-devel@nongnu.org; Fri, 15 Mar 2013 10:34:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGViG-0007mj-80 for qemu-devel@nongnu.org; Fri, 15 Mar 2013 10:34:30 -0400 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]:32842 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGViG-0007ma-1S for qemu-devel@nongnu.org; Fri, 15 Mar 2013 10:34:28 -0400 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 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-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 v3 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 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); }