Received: from eggs.gnu.org ([208.118.235.92]:55872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWq02-00075S-7K for qemu-devel@nongnu.org; Fri, 09 Nov 2012 09:56:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWpzv-0005Xe-Fl for qemu-devel@nongnu.org; Fri, 09 Nov 2012 09:56:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWpzv-0005Wt-6L for qemu-devel@nongnu.org; Fri, 09 Nov 2012 09:55:55 -0500 From: Eduardo Habkost Date: Fri, 9 Nov 2012 12:56:49 -0200 Message-Id: <1352473012-20500-22-git-send-email-ehabkost@redhat.com> In-Reply-To: <1352473012-20500-1-git-send-email-ehabkost@redhat.com> References: <1352473012-20500-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 21/24] qdev: add weak alias to sysbus_get_default() on qdev.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, blauwirbel@gmail.com, Anthony Liguori , Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= This version will be used on cases where sysbus.c is not compiled in (e.g. *-user). Signed-off-by: Eduardo Habkost --- Changes v1 -> v2: - Use the new QEMU_WEAK_ALIAS mechanism, instead of GCC_WEAK --- hw/qdev-core.h | 5 ++++- hw/qdev.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index 494b687..b64daf0 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -193,7 +193,10 @@ void qbus_free(BusState *bus); #define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev) -/* This should go away once we get rid of the NULL bus hack */ +/* This should go away once we get rid of the NULL bus hack. + * This has a weak alias for a stub function on qdev.c (for *-user, that + * doesn't have a main system bus). + */ BusState *sysbus_get_default(void); char *qdev_get_fw_dev_path(DeviceState *dev); diff --git a/hw/qdev.c b/hw/qdev.c index 94ae1cd..0702659 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -100,6 +100,19 @@ static void stub_vmstate_unregister(DeviceState *dev, } QEMU_WEAK_ALIAS(vmstate_unregister, stub_vmstate_unregister); + +/* sysbus stub functions + * + * The real implementation is on sysbus.c, but the stub functions will be used + * on cases where sysbus.c is not compiled in (e.g. *-user). + */ + +static BusState *sysbus_get_none(void) +{ + return NULL; +} +QEMU_WEAK_ALIAS(sysbus_get_default, sysbus_get_none); + const VMStateDescription *qdev_get_vmsd(DeviceState *dev) { DeviceClass *dc = DEVICE_GET_CLASS(dev); -- 1.7.11.7