Patchwork [21/24] qdev: add sysbus_get_default() GCC_WEAK stub

login
register
mail settings
Submitter Eduardo Habkost
Date Nov. 9, 2012, 1:08 p.m.
Message ID <1352466519-5779-22-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/198070/
State New
Headers show

Comments

Eduardo Habkost - Nov. 9, 2012, 1:08 p.m.
This version will be used on cases where sysbus.c is not compiled in
(e.g. *-user).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/qdev-core.h |  2 +-
 hw/qdev.c      | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

Patch

diff --git a/hw/qdev-core.h b/hw/qdev-core.h
index 494b687..19d9e03 100644
--- a/hw/qdev-core.h
+++ b/hw/qdev-core.h
@@ -194,7 +194,7 @@  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 */
-BusState *sysbus_get_default(void);
+GCC_WEAK_DECL BusState *sysbus_get_default(void);
 
 char *qdev_get_fw_dev_path(DeviceState *dev);
 
diff --git a/hw/qdev.c b/hw/qdev.c
index fe4de96..1c4ff03 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -97,6 +97,18 @@  GCC_WEAK void vmstate_unregister(DeviceState *dev,
 {
 }
 
+
+/* 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).
+ */
+
+GCC_WEAK BusState *sysbus_get_default(void)
+{
+    return NULL;
+}
+
 const VMStateDescription *qdev_get_vmsd(DeviceState *dev)
 {
     DeviceClass *dc = DEVICE_GET_CLASS(dev);