Patchwork [12/12] savevm: Port to qdev.vmsd all devices that have qdev

login
register
mail settings
Submitter Juan Quintela
Date Dec. 2, 2009, 11:36 a.m.
Message ID <514678c8ddc61f45cb41929aeeb3c7838ef2a556.1259753146.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/40005/
State New
Headers show

Comments

Juan Quintela - Dec. 2, 2009, 11:36 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/ac97.c         |    2 +-
 hw/cirrus_vga.c   |    2 +-
 hw/cs4231a.c      |    2 +-
 hw/e1000.c        |    4 +---
 hw/es1370.c       |    2 +-
 hw/gus.c          |    2 +-
 hw/lance.c        |   14 ++++++++++++--
 hw/lm832x.c       |    2 +-
 hw/lsi53c895a.c   |    2 +-
 hw/max7310.c      |    2 +-
 hw/ne2000-isa.c   |   12 +++++++++++-
 hw/ne2000.c       |    3 +--
 hw/pckbd.c        |   13 ++++++++++++-
 hw/pcnet.c        |    4 +---
 hw/piix_pci.c     |    4 ++--
 hw/rtl8139.c      |    4 +---
 hw/sb16.c         |    2 +-
 hw/ssd0303.c      |    2 +-
 hw/tmp105.c       |    2 +-
 hw/twl92230.c     |    2 +-
 hw/usb-uhci.c     |    3 ++-
 hw/vga-pci.c      |    2 +-
 hw/vmware_vga.c   |    2 +-
 hw/wdt_i6300esb.c |    3 +--
 hw/wdt_ib700.c    |    2 +-
 hw/wm8750.c       |    2 +-
 26 files changed, 60 insertions(+), 36 deletions(-)

Patch

diff --git a/hw/ac97.c b/hw/ac97.c
index f2d2823..62e349a 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1319,7 +1319,6 @@  static int ac97_initfn (PCIDevice *dev)
     pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO,
                       ac97_map);
     pci_register_bar (&s->dev, 1, 64 * 4, PCI_BASE_ADDRESS_SPACE_IO, ac97_map);
-    vmstate_register (0, &vmstate_ac97, s);
     qemu_register_reset (ac97_on_reset, s);
     AUD_register_card ("ac97", &s->card);
     ac97_on_reset (s);
@@ -1336,6 +1335,7 @@  static PCIDeviceInfo ac97_info = {
     .qdev.name    = "AC97",
     .qdev.desc    = "Intel 82801AA AC97 Audio",
     .qdev.size    = sizeof (AC97LinkState),
+    .qdev.vmsd    = &vmstate_ac97,
     .init         = ac97_initfn,
 };

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index d76e5bb..1194b5a 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3245,7 +3245,6 @@  static int pci_cirrus_vga_initfn(PCIDevice *dev)
          pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
                           PCI_BASE_ADDRESS_SPACE_MEMORY, cirrus_pci_mmio_map);
      }
-     vmstate_register(0, &vmstate_pci_cirrus_vga, d);

      /* ROM BIOS */
      rom_add_vga(VGABIOS_CIRRUS_FILENAME);
@@ -3260,6 +3259,7 @@  void pci_cirrus_vga_init(PCIBus *bus)
 static PCIDeviceInfo cirrus_vga_info = {
     .qdev.name    = "Cirrus VGA",
     .qdev.size    = sizeof(PCICirrusVGAState),
+    .qdev.vmsd    = &vmstate_pci_cirrus_vga,
     .init         = pci_cirrus_vga_initfn,
     .config_write = pci_cirrus_write_config,
 };
diff --git a/hw/cs4231a.c b/hw/cs4231a.c
index 7c29aa8..4d5ce5c 100644
--- a/hw/cs4231a.c
+++ b/hw/cs4231a.c
@@ -651,7 +651,6 @@  static int cs4231a_initfn (ISADevice *dev)

     DMA_register_channel (s->dma, cs_dma_read, s);

-    vmstate_register (0, &vmstate_cs4231a, s);
     qemu_register_reset (cs_reset, s);
     cs_reset (s);

@@ -669,6 +668,7 @@  static ISADeviceInfo cs4231a_info = {
     .qdev.name     = "cs4231a",
     .qdev.desc     = "Crystal Semiconductor CS4231A",
     .qdev.size     = sizeof (CSState),
+    .qdev.vmsd     = &vmstate_cs4231a,
     .init          = cs4231a_initfn,
     .qdev.props    = (Property[]) {
         DEFINE_PROP_HEX32  ("iobase",  CSState, port, 0x534),
diff --git a/hw/e1000.c b/hw/e1000.c
index 00f6a57..782a60b 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1051,7 +1051,6 @@  pci_e1000_uninit(PCIDevice *dev)

     cpu_unregister_io_memory(d->mmio_index);
     qemu_del_vlan_client(d->vc);
-    vmstate_unregister(&vmstate_e1000, d);
     return 0;
 }

@@ -1116,8 +1115,6 @@  static int pci_e1000_init(PCIDevice *pci_dev)

     qemu_format_nic_info_str(d->vc, macaddr);

-    vmstate_register(-1, &vmstate_e1000, d);
-
     if (!pci_dev->qdev.hotplugged) {
         static int loaded = 0;
         if (!loaded) {
@@ -1139,6 +1136,7 @@  static PCIDeviceInfo e1000_info = {
     .qdev.desc  = "Intel Gigabit Ethernet",
     .qdev.size  = sizeof(E1000State),
     .qdev.reset = qdev_e1000_reset,
+    .qdev.vmsd  = &vmstate_e1000,
     .init       = pci_e1000_init,
     .exit       = pci_e1000_uninit,
     .qdev.props = (Property[]) {
diff --git a/hw/es1370.c b/hw/es1370.c
index 4e646dc..c358253 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1023,7 +1023,6 @@  static int es1370_initfn (PCIDevice *dev)
     c[0x3f] = 0x80;

     pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, es1370_map);
-    vmstate_register (0, &vmstate_es1370, s);
     qemu_register_reset (es1370_on_reset, s);

     AUD_register_card ("es1370", &s->card);
@@ -1041,6 +1040,7 @@  static PCIDeviceInfo es1370_info = {
     .qdev.name    = "ES1370",
     .qdev.desc    = "ENSONIQ AudioPCI ES1370",
     .qdev.size    = sizeof (ES1370State),
+    .qdev.vmsd    = &vmstate_es1370,
     .init         = es1370_initfn,
 };

diff --git a/hw/gus.c b/hw/gus.c
index d35da0a..e9016d8 100644
--- a/hw/gus.c
+++ b/hw/gus.c
@@ -287,7 +287,6 @@  static int gus_initfn (ISADevice *dev)

     AUD_set_active_out (s->voice, 1);

-    vmstate_register (0, &vmstate_gus, s);
     return 0;
 }

@@ -301,6 +300,7 @@  static ISADeviceInfo gus_info = {
     .qdev.name     = "gus",
     .qdev.desc     = "Gravis Ultrasound GF1",
     .qdev.size     = sizeof (GUSState),
+    .qdev.vmsd     = &vmstate_gus,
     .init          = gus_initfn,
     .qdev.props    = (Property[]) {
         DEFINE_PROP_UINT32 ("freq",    GUSState, freq,        44100),
diff --git a/hw/lance.c b/hw/lance.c
index 0a96644..1f31d10 100644
--- a/hw/lance.c
+++ b/hw/lance.c
@@ -96,10 +96,20 @@  static void lance_cleanup(VLANClientState *vc)
 {
     PCNetState *d = vc->opaque;

-    vmstate_unregister(&vmstate_pcnet, d);
     pcnet_common_cleanup(d);
 }

+static const VMStateDescription vmstate_lance = {
+    .name = "pcnet",
+    .version_id = 3,
+    .minimum_version_id = 2,
+    .minimum_version_id_old = 2,
+    .fields      = (VMStateField []) {
+        VMSTATE_STRUCT(state, SysBusPCNetState, 0, vmstate_pcnet, PCNetState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int lance_init(SysBusDevice *dev)
 {
     SysBusPCNetState *d = FROM_SYSBUS(SysBusPCNetState, dev);
@@ -117,7 +127,6 @@  static int lance_init(SysBusDevice *dev)
     s->phys_mem_read = ledma_memory_read;
     s->phys_mem_write = ledma_memory_write;

-    vmstate_register(-1, &vmstate_pcnet, d);
     return pcnet_common_init(&dev->qdev, s, lance_cleanup);
 }

@@ -133,6 +142,7 @@  static SysBusDeviceInfo lance_info = {
     .qdev.name  = "lance",
     .qdev.size  = sizeof(SysBusPCNetState),
     .qdev.reset = lance_reset,
+    .qdev.vmsd  = &vmstate_lance,
     .qdev.props = (Property[]) {
         DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
         DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
diff --git a/hw/lm832x.c b/hw/lm832x.c
index 7e552c7..ce7dcac 100644
--- a/hw/lm832x.c
+++ b/hw/lm832x.c
@@ -471,7 +471,6 @@  static int lm8323_init(i2c_slave *i2c)
     lm_kbd_reset(s);

     qemu_register_reset((void *) lm_kbd_reset, s);
-    vmstate_register(-1, &vmstate_lm_kbd, s);
     return 0;
 }

@@ -498,6 +497,7 @@  void lm832x_key_event(struct i2c_slave *i2c, int key, int state)
 static I2CSlaveInfo lm8323_info = {
     .qdev.name = "lm8323",
     .qdev.size = sizeof(LM823KbdState),
+    .qdev.vmsd = &vmstate_lm_kbd,
     .init = lm8323_init,
     .event = lm_i2c_event,
     .recv = lm_i2c_rx,
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 8b8a80b..01caca0 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2106,7 +2106,6 @@  static int lsi_scsi_init(PCIDevice *dev)
     if (!dev->qdev.hotplugged) {
         scsi_bus_legacy_handle_cmdline(&s->bus);
     }
-    vmstate_register(-1, &vmstate_lsi_scsi, s);
     return 0;
 }

@@ -2114,6 +2113,7 @@  static PCIDeviceInfo lsi_info = {
     .qdev.name  = "lsi53c895a",
     .qdev.alias = "lsi",
     .qdev.size  = sizeof(LSIState),
+    .qdev.vmsd  = &vmstate_lsi_scsi,
     .init       = lsi_scsi_init,
     .exit       = lsi_scsi_uninit,
 };
diff --git a/hw/max7310.c b/hw/max7310.c
index 0ce6ac9..c302eb6 100644
--- a/hw/max7310.c
+++ b/hw/max7310.c
@@ -184,7 +184,6 @@  static int max7310_init(i2c_slave *i2c)

     max7310_reset(&s->i2c);

-    vmstate_register(-1, &vmstate_max7310, s);
     return 0;
 }

@@ -206,6 +205,7 @@  void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler)
 static I2CSlaveInfo max7310_info = {
     .qdev.name = "max7310",
     .qdev.size = sizeof(MAX7310State),
+    .qdev.vmsd = &vmstate_max7310,
     .init = max7310_init,
     .event = max7310_event,
     .recv = max7310_rx,
diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 729e8e2..5a5bc2d 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -42,6 +42,17 @@  static void isa_ne2000_cleanup(VLANClientState *vc)
     s->vc = NULL;
 }

+const VMStateDescription vmstate_isa_ne2000 = {
+    .name = "ne2000",
+    .version_id = 2,
+    .minimum_version_id = 0,
+    .minimum_version_id_old = 0,
+    .fields      = (VMStateField []) {
+        VMSTATE_STRUCT(ne2000, ISANE2000State, 0, vmstate_ne2000, NE2000State),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int isa_ne2000_initfn(ISADevice *dev)
 {
     ISANE2000State *isa = DO_UPCAST(ISANE2000State, dev, dev);
@@ -69,7 +80,6 @@  static int isa_ne2000_initfn(ISADevice *dev)
                                  NULL, isa_ne2000_cleanup, s);
     qemu_format_nic_info_str(s->vc, s->c.macaddr.a);

-    vmstate_register(-1, &vmstate_ne2000, s);
     return 0;
 }

diff --git a/hw/ne2000.c b/hw/ne2000.c
index 63efc3a..641b00f 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -739,7 +739,6 @@  static int pci_ne2000_init(PCIDevice *pci_dev)
         }
     }

-    vmstate_register(-1, &vmstate_pci_ne2000, d);
     return 0;
 }

@@ -748,7 +747,6 @@  static int pci_ne2000_exit(PCIDevice *pci_dev)
     PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev);
     NE2000State *s = &d->ne2000;

-    vmstate_unregister(&vmstate_pci_ne2000, s);
     qemu_del_vlan_client(s->vc);
     return 0;
 }
@@ -756,6 +754,7 @@  static int pci_ne2000_exit(PCIDevice *pci_dev)
 static PCIDeviceInfo ne2000_info = {
     .qdev.name  = "ne2k_pci",
     .qdev.size  = sizeof(PCINE2000State),
+    .qdev.vmsd  = &vmstate_pci_ne2000,
     .init       = pci_ne2000_init,
     .exit       = pci_ne2000_exit,
     .qdev.props = (Property[]) {
diff --git a/hw/pckbd.c b/hw/pckbd.c
index a81b303..7e0d68d 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -414,6 +414,17 @@  typedef struct ISAKBDState {
     KBDState  kbd;
 } ISAKBDState;

+const VMStateDescription vmstate_kbd_isa = {
+    .name = "pckbd",
+    .version_id = 3,
+    .minimum_version_id = 3,
+    .minimum_version_id_old = 3,
+    .fields      = (VMStateField []) {
+        VMSTATE_STRUCT(kbd, ISAKBDState, 0, vmstate_kbd, KBDState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int i8042_initfn(ISADevice *dev)
 {
     KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd);
@@ -421,7 +432,6 @@  static int i8042_initfn(ISADevice *dev)
     isa_init_irq(dev, &s->irq_kbd, 1);
     isa_init_irq(dev, &s->irq_mouse, 12);

-    vmstate_register(0, &vmstate_kbd, s);
     register_ioport_read(0x60, 1, 1, kbd_read_data, s);
     register_ioport_write(0x60, 1, 1, kbd_write_data, s);
     register_ioport_read(0x64, 1, 1, kbd_read_status, s);
@@ -439,6 +449,7 @@  static int i8042_initfn(ISADevice *dev)
 static ISADeviceInfo i8042_info = {
     .qdev.name     = "i8042",
     .qdev.size     = sizeof(ISAKBDState),
+    .qdev.vmsd     = &vmstate_kbd_isa,
     .qdev.no_user  = 1,
     .init          = i8042_initfn,
 };
diff --git a/hw/pcnet.c b/hw/pcnet.c
index ee3db09..e2e4dd5 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1957,7 +1957,6 @@  static int pci_pcnet_uninit(PCIDevice *dev)
     PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev);

     cpu_unregister_io_memory(d->state.mmio_index);
-    vmstate_unregister(&vmstate_pci_pcnet, d);
     qemu_del_timer(d->state.poll_timer);
     qemu_free_timer(d->state.poll_timer);
     qemu_del_vlan_client(d->state.vc);
@@ -2007,8 +2006,6 @@  static int pci_pcnet_init(PCIDevice *pci_dev)
     s->phys_mem_read = pci_physical_memory_read;
     s->phys_mem_write = pci_physical_memory_write;

-    vmstate_register(-1, &vmstate_pci_pcnet, d);
-
     if (!pci_dev->qdev.hotplugged) {
         static int loaded = 0;
         if (!loaded) {
@@ -2031,6 +2028,7 @@  static PCIDeviceInfo pcnet_info = {
     .qdev.name  = "pcnet",
     .qdev.size  = sizeof(PCIPCNetState),
     .qdev.reset = pci_reset,
+    .qdev.vmsd  = &vmstate_pci_pcnet,
     .init       = pci_pcnet_init,
     .exit       = pci_pcnet_uninit,
     .qdev.props = (Property[]) {
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index a44f941..1b67475 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -198,7 +198,6 @@  static int i440fx_initfn(PCIDevice *dev)

     d->dev.config[0x72] = 0x02; /* SMRAM */

-    vmstate_register(0, &vmstate_i440fx, d);
     return 0;
 }

@@ -312,7 +311,6 @@  static int piix3_initfn(PCIDevice *dev)
     uint8_t *pci_conf;

     isa_bus_new(&d->dev.qdev);
-    vmstate_register(0, &vmstate_piix3, d);

     pci_conf = d->dev.config;
     pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
@@ -330,6 +328,7 @@  static PCIDeviceInfo i440fx_info[] = {
         .qdev.name    = "i440FX",
         .qdev.desc    = "Host bridge",
         .qdev.size    = sizeof(PCII440FXState),
+        .qdev.vmsd    = &vmstate_i440fx,
         .qdev.no_user = 1,
         .init         = i440fx_initfn,
         .config_write = i440fx_write_config,
@@ -337,6 +336,7 @@  static PCIDeviceInfo i440fx_info[] = {
         .qdev.name    = "PIIX3",
         .qdev.desc    = "ISA bridge",
         .qdev.size    = sizeof(PIIX3State),
+        .qdev.vmsd    = &vmstate_piix3,
         .qdev.no_user = 1,
         .init         = piix3_initfn,
     },{
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index c166db0..1a0df5e 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3300,7 +3300,6 @@  static int pci_rtl8139_uninit(PCIDevice *dev)
     qemu_del_timer(s->timer);
     qemu_free_timer(s->timer);
 #endif
-    vmstate_unregister(&vmstate_rtl8139, s);
     qemu_del_vlan_client(s->vc);
     return 0;
 }
@@ -3343,8 +3342,6 @@  static int pci_rtl8139_init(PCIDevice *dev)
     s->cplus_txbuffer_len = 0;
     s->cplus_txbuffer_offset = 0;

-    vmstate_register(-1, &vmstate_rtl8139, s);
-
 #ifdef RTL8139_ONBOARD_TIMER
     s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);

@@ -3366,6 +3363,7 @@  static PCIDeviceInfo rtl8139_info = {
     .qdev.name  = "rtl8139",
     .qdev.size  = sizeof(RTL8139State),
     .qdev.reset = rtl8139_reset,
+    .qdev.vmsd  = &vmstate_rtl8139,
     .init       = pci_rtl8139_init,
     .exit       = pci_rtl8139_uninit,
     .qdev.props = (Property[]) {
diff --git a/hw/sb16.c b/hw/sb16.c
index 4c0d682..9f4ac50 100644
--- a/hw/sb16.c
+++ b/hw/sb16.c
@@ -1381,7 +1381,6 @@  static int sb16_initfn (ISADevice *dev)
     DMA_register_channel (s->dma, SB_read_DMA, s);
     s->can_write = 1;

-    vmstate_register (0, &vmstate_sb16, s);
     AUD_register_card ("sb16", &s->card);
     return 0;
 }
@@ -1396,6 +1395,7 @@  static ISADeviceInfo sb16_info = {
     .qdev.name     = "sb16",
     .qdev.desc     = "Creative Sound Blaster 16",
     .qdev.size     = sizeof (SB16State),
+    .qdev.vmsd     = &vmstate_sb16,
     .init          = sb16_initfn,
     .qdev.props    = (Property[]) {
         DEFINE_PROP_HEX32  ("version", SB16State, ver,  0x0405), /* 4.5 */
diff --git a/hw/ssd0303.c b/hw/ssd0303.c
index f60930e..108c068 100644
--- a/hw/ssd0303.c
+++ b/hw/ssd0303.c
@@ -291,13 +291,13 @@  static int ssd0303_init(i2c_slave *i2c)
                                  ssd0303_invalidate_display,
                                  NULL, NULL, s);
     qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY);
-    vmstate_register(-1, &vmstate_ssd0303, s);
     return 0;
 }

 static I2CSlaveInfo ssd0303_info = {
     .qdev.name = "ssd0303",
     .qdev.size = sizeof(ssd0303_state),
+    .qdev.vmsd = &vmstate_ssd0303,
     .init = ssd0303_init,
     .event = ssd0303_event,
     .recv = ssd0303_recv,
diff --git a/hw/tmp105.c b/hw/tmp105.c
index 74141b3..8343aff 100644
--- a/hw/tmp105.c
+++ b/hw/tmp105.c
@@ -228,13 +228,13 @@  static int tmp105_init(i2c_slave *i2c)

     tmp105_reset(&s->i2c);

-    vmstate_register(-1, &vmstate_tmp105, s);
     return 0;
 }

 static I2CSlaveInfo tmp105_info = {
     .qdev.name = "tmp105",
     .qdev.size = sizeof(TMP105State),
+    .qdev.vmsd = &vmstate_tmp105,
     .init = tmp105_init,
     .event = tmp105_event,
     .recv = tmp105_rx,
diff --git a/hw/twl92230.c b/hw/twl92230.c
index 93232da..b1b2ac9 100644
--- a/hw/twl92230.c
+++ b/hw/twl92230.c
@@ -855,13 +855,13 @@  static int twl92230_init(i2c_slave *i2c)

     menelaus_reset(&s->i2c);

-    vmstate_register(-1, &vmstate_menelaus, s);
     return 0;
 }

 static I2CSlaveInfo twl92230_info = {
     .qdev.name ="twl92230",
     .qdev.size = sizeof(MenelausState),
+    .qdev.vmsd = &vmstate_menelaus,
     .init = twl92230_init,
     .event = menelaus_event,
     .recv = menelaus_rx,
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 671916e..ba26a4e 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1086,7 +1086,6 @@  static int usb_uhci_common_initfn(UHCIState *s)
     pci_register_bar(&s->dev, 4, 0x20,
                            PCI_BASE_ADDRESS_SPACE_IO, uhci_map);

-    vmstate_register(0, &vmstate_uhci, s);
     return 0;
 }

@@ -1114,10 +1113,12 @@  static PCIDeviceInfo uhci_info[] = {
     {
         .qdev.name    = "PIIX3 USB-UHCI",
         .qdev.size    = sizeof(UHCIState),
+        .qdev.vmsd    = &vmstate_uhci,
         .init         = usb_uhci_piix3_initfn,
     },{
         .qdev.name    = "PIIX4 USB-UHCI",
         .qdev.size    = sizeof(UHCIState),
+        .qdev.vmsd    = &vmstate_uhci,
         .init         = usb_uhci_piix4_initfn,
     },{
         /* end of list */
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 234d581..14cecdc 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -82,7 +82,6 @@  static int pci_vga_initfn(PCIDevice *dev)
      // vga + console init
      vga_common_init(s, VGA_RAM_SIZE);
      vga_init(s);
-     vmstate_register(0, &vmstate_vga_pci, d);

      s->ds = graphic_console_init(s->update, s->invalidate,
                                   s->screen_dump, s->text_update, s);
@@ -128,6 +127,7 @@  int pci_vga_init(PCIBus *bus,
 static PCIDeviceInfo vga_info = {
     .qdev.name    = "VGA",
     .qdev.size    = sizeof(PCIVGAState),
+    .qdev.vmsd    = &vmstate_vga_pci,
     .init         = pci_vga_initfn,
     .config_write = pci_vga_write_config,
     .qdev.props   = (Property[]) {
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index bb34101..24ea620 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1189,7 +1189,6 @@  static int pci_vmsvga_initfn(PCIDevice *dev)

     vmsvga_init(&s->chip, VGA_RAM_SIZE);

-    vmstate_register(0, &vmstate_vmware_vga, s);
     return 0;
 }

@@ -1201,6 +1200,7 @@  void pci_vmsvga_init(PCIBus *bus)
 static PCIDeviceInfo vmsvga_info = {
     .qdev.name    = "QEMUware SVGA",
     .qdev.size    = sizeof(struct pci_vmsvga_state_s),
+    .qdev.vmsd    = &vmstate_vmware_vga,
     .init         = pci_vmsvga_initfn,
 };

diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 27fa09e..805b302 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -416,8 +416,6 @@  static int i6300esb_init(PCIDevice *dev)
     pci_register_bar(&d->dev, 0, 0x10,
                             PCI_BASE_ADDRESS_SPACE_MEMORY, i6300esb_map);

-    vmstate_register(-1, &vmstate_i6300esb, d);
-
     return 0;
 }

@@ -429,6 +427,7 @@  static WatchdogTimerModel model = {
 static PCIDeviceInfo i6300esb_info = {
     .qdev.name    = "i6300esb",
     .qdev.size    = sizeof(I6300State),
+    .qdev.vmsd    = &vmstate_i6300esb,
     .config_read  = i6300esb_config_read,
     .config_write = i6300esb_config_write,
     .init         = i6300esb_init,
diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c
index d67bf9e..c34687b 100644
--- a/hw/wdt_ib700.c
+++ b/hw/wdt_ib700.c
@@ -98,7 +98,6 @@  static int wdt_ib700_init(ISADevice *dev)
     IB700State *s = DO_UPCAST(IB700State, dev, dev);

     s->timer = qemu_new_timer(vm_clock, ib700_timer_expired, s);
-    vmstate_register(-1, &vmstate_ib700, s);
     register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, s);
     register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, s);

@@ -113,6 +112,7 @@  static WatchdogTimerModel model = {
 static ISADeviceInfo wdt_ib700_info = {
     .qdev.name = "ib700",
     .qdev.size = sizeof(IB700State),
+    .qdev.vmsd = &vmstate_ib700,
     .init      = wdt_ib700_init,
 };

diff --git a/hw/wm8750.c b/hw/wm8750.c
index e6a9c06..6064da0 100644
--- a/hw/wm8750.c
+++ b/hw/wm8750.c
@@ -622,7 +622,6 @@  static int wm8750_init(i2c_slave *i2c)
     AUD_register_card(CODEC, &s->card);
     wm8750_reset(&s->i2c);

-    vmstate_register(-1, &vmstate_wm8750, s);
     return 0;
 }

@@ -699,6 +698,7 @@  void wm8750_set_bclk_in(void *opaque, int new_hz)
 static I2CSlaveInfo wm8750_info = {
     .qdev.name = "wm8750",
     .qdev.size = sizeof(WM8750State),
+    .qdev.vmsd = &vmstate_wm8750,
     .init = wm8750_init,
     .event = wm8750_event,
     .recv = wm8750_rx,