Patchwork [2/4] qdev: automatically register device info

login
register
mail settings
Submitter Blue Swirl
Date May 12, 2010, 8:57 p.m.
Message ID <AANLkTikl9vqE2ImDCmYX33O0FMb6KSTQN7IH2MXLeCBf@mail.gmail.com>
Download mbox | patch
Permalink /patch/52442/
State New
Headers show

Comments

Blue Swirl - May 12, 2010, 8:57 p.m.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/qdev.c |    3 +++
 hw/qdev.h |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index d3bf0fa..258bbef 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -280,6 +280,9 @@  int qdev_init(DeviceState *dev)
     qemu_register_reset(qdev_reset, dev);
     if (dev->info->vmsd)
         vmstate_register(-1, dev->info->vmsd, dev);
+    if (dev->info->mdi) {
+        monitor_register_device_info(dev->info->mdi, dev);
+    }
     dev->state = DEV_STATE_INITIALIZED;
     return 0;
 }
diff --git a/hw/qdev.h b/hw/qdev.h
index d8fbc73..f85903a 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -142,6 +142,9 @@  struct DeviceInfo {
     /* device state */
     const VMStateDescription *vmsd;

+    /* monitor info handler */
+    const struct MonDevInfo *mdi;
+
     /* Private to qdev / bus.  */
     qdev_initfn init;
     qdev_event unplug;