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 From: Peter Maydell Date: Fri, 15 Mar 2013 14:34:19 +0000 Message-Id: <1363358063-23973-2-git-send-email-peter.maydell@linaro.org> 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v3 1/5] sysbus: make SysBusDeviceClass::init optional List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Michael Walle , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.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); } -- 1.7.9.5