Patchwork [qom-next,for-next,v2,1/6] pci: Simplify VMSTATE_PCI_DEVICE() macro

login
register
mail settings
Submitter Andreas Färber
Date July 29, 2013, 12:26 a.m.
Message ID <1375057621-19961-2-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/262631/
State New
Headers show

Comments

Andreas Färber - July 29, 2013, 12:26 a.m.
Drop the arguments to avoid QOM refactorings causing more churn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/acpi/piix4.c                | 2 +-
 hw/audio/ac97.c                | 2 +-
 hw/audio/es1370.c              | 2 +-
 hw/audio/intel-hda.c           | 2 +-
 hw/char/serial-pci.c           | 4 ++--
 hw/char/tpci200.c              | 2 +-
 hw/display/cirrus_vga.c        | 2 +-
 hw/display/qxl.c               | 2 +-
 hw/display/vga-pci.c           | 2 +-
 hw/display/vmware_vga.c        | 2 +-
 hw/i2c/smbus_ich9.c            | 2 +-
 hw/ide/ich.c                   | 2 +-
 hw/ide/pci.c                   | 2 +-
 hw/isa/i82378.c                | 2 +-
 hw/isa/lpc_ich9.c              | 2 +-
 hw/isa/piix4.c                 | 2 +-
 hw/isa/vt82c686.c              | 4 ++--
 hw/net/e1000.c                 | 2 +-
 hw/net/eepro100.c              | 2 +-
 hw/net/ne2000.c                | 2 +-
 hw/net/pcnet-pci.c             | 2 +-
 hw/net/rtl8139.c               | 2 +-
 hw/net/vmxnet3.c               | 2 +-
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 hw/pci-host/bonito.c           | 2 +-
 hw/pci-host/piix.c             | 4 ++--
 hw/pci-host/prep.c             | 2 +-
 hw/pci-host/q35.c              | 2 +-
 hw/scsi/esp-pci.c              | 2 +-
 hw/scsi/lsi53c895a.c           | 2 +-
 hw/scsi/megasas.c              | 2 +-
 hw/scsi/vmw_pvscsi.c           | 2 +-
 hw/usb/hcd-ehci-pci.c          | 2 +-
 hw/usb/hcd-uhci.c              | 2 +-
 hw/watchdog/wdt_i6300esb.c     | 2 +-
 hw/xen/xen_platform.c          | 2 +-
 include/hw/pci/pci.h           | 6 +++---
 37 files changed, 42 insertions(+), 42 deletions(-)
Michael S. Tsirkin - Sept. 2, 2013, 11:38 a.m.
On Mon, Jul 29, 2013 at 02:26:56AM +0200, Andreas Färber wrote:
> Drop the arguments to avoid QOM refactorings causing more churn.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>

This discards compiler check that macro is used
appropriately and does not add a runtime check.

We discussed and discarded this approach in
the previous round of patches you sent.

Yes "parent_obj" in code is ugly, but
this is not a good solution.


> ---
>  hw/acpi/piix4.c                | 2 +-
>  hw/audio/ac97.c                | 2 +-
>  hw/audio/es1370.c              | 2 +-
>  hw/audio/intel-hda.c           | 2 +-
>  hw/char/serial-pci.c           | 4 ++--
>  hw/char/tpci200.c              | 2 +-
>  hw/display/cirrus_vga.c        | 2 +-
>  hw/display/qxl.c               | 2 +-
>  hw/display/vga-pci.c           | 2 +-
>  hw/display/vmware_vga.c        | 2 +-
>  hw/i2c/smbus_ich9.c            | 2 +-
>  hw/ide/ich.c                   | 2 +-
>  hw/ide/pci.c                   | 2 +-
>  hw/isa/i82378.c                | 2 +-
>  hw/isa/lpc_ich9.c              | 2 +-
>  hw/isa/piix4.c                 | 2 +-
>  hw/isa/vt82c686.c              | 4 ++--
>  hw/net/e1000.c                 | 2 +-
>  hw/net/eepro100.c              | 2 +-
>  hw/net/ne2000.c                | 2 +-
>  hw/net/pcnet-pci.c             | 2 +-
>  hw/net/rtl8139.c               | 2 +-
>  hw/net/vmxnet3.c               | 2 +-
>  hw/pci-bridge/pci_bridge_dev.c | 2 +-
>  hw/pci-host/bonito.c           | 2 +-
>  hw/pci-host/piix.c             | 4 ++--
>  hw/pci-host/prep.c             | 2 +-
>  hw/pci-host/q35.c              | 2 +-
>  hw/scsi/esp-pci.c              | 2 +-
>  hw/scsi/lsi53c895a.c           | 2 +-
>  hw/scsi/megasas.c              | 2 +-
>  hw/scsi/vmw_pvscsi.c           | 2 +-
>  hw/usb/hcd-ehci-pci.c          | 2 +-
>  hw/usb/hcd-uhci.c              | 2 +-
>  hw/watchdog/wdt_i6300esb.c     | 2 +-
>  hw/xen/xen_platform.c          | 2 +-
>  include/hw/pci/pci.h           | 6 +++---
>  37 files changed, 42 insertions(+), 42 deletions(-)
> 
> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> index c885690..c95d0b4 100644
> --- a/hw/acpi/piix4.c
> +++ b/hw/acpi/piix4.c
> @@ -294,7 +294,7 @@ static const VMStateDescription vmstate_acpi = {
>      .load_state_old = acpi_load_old,
>      .post_load = vmstate_acpi_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT16(ar.pm1.evt.sts, PIIX4PMState),
>          VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
>          VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState),
> diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
> index 365b2f1..d23882b 100644
> --- a/hw/audio/ac97.c
> +++ b/hw/audio/ac97.c
> @@ -1214,7 +1214,7 @@ static const VMStateDescription vmstate_ac97 = {
>      .minimum_version_id_old = 2,
>      .post_load = ac97_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE (dev, AC97LinkState),
> +        VMSTATE_PCI_DEVICE (),
>          VMSTATE_UINT32 (glob_cnt, AC97LinkState),
>          VMSTATE_UINT32 (glob_sta, AC97LinkState),
>          VMSTATE_UINT32 (cas, AC97LinkState),
> diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
> index f2c40da..d681a44 100644
> --- a/hw/audio/es1370.c
> +++ b/hw/audio/es1370.c
> @@ -1000,7 +1000,7 @@ static const VMStateDescription vmstate_es1370 = {
>      .minimum_version_id_old = 2,
>      .post_load = es1370_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE (dev, ES1370State),
> +        VMSTATE_PCI_DEVICE (),
>          VMSTATE_STRUCT_ARRAY (chan, ES1370State, NB_CHANNELS, 2,
>                                vmstate_es1370_channel, struct chan),
>          VMSTATE_UINT32 (ctl, ES1370State),
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index 58984dc..fb7f8ef 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -1191,7 +1191,7 @@ static const VMStateDescription vmstate_intel_hda = {
>      .version_id = 1,
>      .post_load = intel_hda_post_load,
>      .fields = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(pci, IntelHDAState),
> +        VMSTATE_PCI_DEVICE(),
>  
>          /* registers */
>          VMSTATE_UINT32(g_ctl, IntelHDAState),
> diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
> index a17c702..f6a21af 100644
> --- a/hw/char/serial-pci.c
> +++ b/hw/char/serial-pci.c
> @@ -155,7 +155,7 @@ static const VMStateDescription vmstate_pci_serial = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, PCISerialState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(state, PCISerialState, 0, vmstate_serial, SerialState),
>          VMSTATE_END_OF_LIST()
>      }
> @@ -166,7 +166,7 @@ static const VMStateDescription vmstate_pci_multi_serial = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, PCIMultiSerialState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT_ARRAY(state, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS,
>                               0, vmstate_serial, SerialState),
>          VMSTATE_UINT32_ARRAY(level, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS),
> diff --git a/hw/char/tpci200.c b/hw/char/tpci200.c
> index a199e57..2ba5ad2 100644
> --- a/hw/char/tpci200.c
> +++ b/hw/char/tpci200.c
> @@ -631,7 +631,7 @@ static const VMStateDescription vmstate_tpci200 = {
>      .minimum_version_id = 1,
>      .minimum_version_id_old = 1,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, TPCI200State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_BOOL_ARRAY(big_endian, TPCI200State, 3),
>          VMSTATE_UINT8_ARRAY(ctrl, TPCI200State, N_MODULES),
>          VMSTATE_UINT16(status, TPCI200State),
> diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
> index a440575..c116bc4 100644
> --- a/hw/display/cirrus_vga.c
> +++ b/hw/display/cirrus_vga.c
> @@ -2746,7 +2746,7 @@ static const VMStateDescription vmstate_pci_cirrus_vga = {
>      .minimum_version_id = 2,
>      .minimum_version_id_old = 2,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, PCICirrusVGAState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(cirrus_vga, PCICirrusVGAState, 0,
>                         vmstate_cirrus_vga, CirrusVGAState),
>          VMSTATE_END_OF_LIST()
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index ddefa06..813c31a 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -2265,7 +2265,7 @@ static VMStateDescription qxl_vmstate = {
>      .pre_load           = qxl_pre_load,
>      .post_load          = qxl_post_load,
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(pci, PCIQXLDevice),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(vga, PCIQXLDevice, 0, vmstate_vga_common, VGACommonState),
>          VMSTATE_UINT32(shadow_rom.mode, PCIQXLDevice),
>          VMSTATE_UINT32(num_free_res, PCIQXLDevice),
> diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
> index 3e150ab..ce76e9c 100644
> --- a/hw/display/vga-pci.c
> +++ b/hw/display/vga-pci.c
> @@ -56,7 +56,7 @@ static const VMStateDescription vmstate_vga_pci = {
>      .minimum_version_id = 2,
>      .minimum_version_id_old = 2,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, PCIVGAState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
> index 3536cde..97c7ba1 100644
> --- a/hw/display/vmware_vga.c
> +++ b/hw/display/vmware_vga.c
> @@ -1179,7 +1179,7 @@ static const VMStateDescription vmstate_vmware_vga = {
>      .minimum_version_id = 0,
>      .minimum_version_id_old = 0,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(parent_obj, struct pci_vmsvga_state_s),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(chip, struct pci_vmsvga_state_s, 0,
>                         vmstate_vmware_vga_internal, struct vmsvga_state_s),
>          VMSTATE_END_OF_LIST()
> diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
> index ca22978..c2ac696 100644
> --- a/hw/i2c/smbus_ich9.c
> +++ b/hw/i2c/smbus_ich9.c
> @@ -50,7 +50,7 @@ static const VMStateDescription vmstate_ich9_smbus = {
>      .minimum_version_id = 1,
>      .minimum_version_id_old = 1,
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, struct ICH9SMBState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_END_OF_LIST()
>      }
>  };
> diff --git a/hw/ide/ich.c b/hw/ide/ich.c
> index 4eb5488..bf16847 100644
> --- a/hw/ide/ich.c
> +++ b/hw/ide/ich.c
> @@ -84,7 +84,7 @@ static const VMStateDescription vmstate_ich9_ahci = {
>      .unmigratable = 1, /* Still buggy under I/O load */
>      .version_id = 1,
>      .fields = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, AHCIPCIState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_AHCI(ahci, AHCIPCIState),
>          VMSTATE_END_OF_LIST()
>      },
> diff --git a/hw/ide/pci.c b/hw/ide/pci.c
> index 91151fc..a3ede4f 100644
> --- a/hw/ide/pci.c
> +++ b/hw/ide/pci.c
> @@ -482,7 +482,7 @@ const VMStateDescription vmstate_ide_pci = {
>      .minimum_version_id_old = 0,
>      .post_load = ide_pci_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PCIIDEState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT_ARRAY(bmdma, PCIIDEState, 2, 0,
>                               vmstate_bmdma, BMDMAState),
>          VMSTATE_IDE_BUS_ARRAY(bus, PCIIDEState, 2),
> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
> index b25ed04..b147b82 100644
> --- a/hw/isa/i82378.c
> +++ b/hw/isa/i82378.c
> @@ -54,7 +54,7 @@ static const VMStateDescription vmstate_pci_i82378 = {
>      .version_id = 0,
>      .minimum_version_id = 0,
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(pci_dev, PCIi82378State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_END_OF_LIST()
>      },
>  };
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index d1921aa..5a9fd03 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -579,7 +579,7 @@ static const VMStateDescription vmstate_ich9_lpc = {
>      .minimum_version_id_old = 1,
>      .post_load = ich9_lpc_post_load,
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(d, ICH9LPCState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(apm, ICH9LPCState, 0, vmstate_apm, APMState),
>          VMSTATE_STRUCT(pm, ICH9LPCState, 0, vmstate_ich9_pm, ICH9LPCPMRegs),
>          VMSTATE_UINT8_ARRAY(chip_config, ICH9LPCState, ICH9_CC_SIZE),
> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
> index 1a1d451..fe13429 100644
> --- a/hw/isa/piix4.c
> +++ b/hw/isa/piix4.c
> @@ -78,7 +78,7 @@ static const VMStateDescription vmstate_piix4 = {
>      .minimum_version_id = 2,
>      .minimum_version_id_old = 2,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, PIIX4State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_END_OF_LIST()
>      }
>  };
> diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
> index 2174eaa..72e2dfd 100644
> --- a/hw/isa/vt82c686.c
> +++ b/hw/isa/vt82c686.c
> @@ -233,7 +233,7 @@ static const VMStateDescription vmstate_acpi = {
>      .minimum_version_id_old = 1,
>      .post_load = vmstate_acpi_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, VT686PMState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT16(ar.pm1.evt.sts, VT686PMState),
>          VMSTATE_UINT16(ar.pm1.evt.en, VT686PMState),
>          VMSTATE_UINT16(ar.pm1.cnt.cnt, VT686PMState),
> @@ -417,7 +417,7 @@ static const VMStateDescription vmstate_via = {
>      .minimum_version_id = 1,
>      .minimum_version_id_old = 1,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, VT82C686BState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_END_OF_LIST()
>      }
>  };
> diff --git a/hw/net/e1000.c b/hw/net/e1000.c
> index b952d8d..a2f3c70 100644
> --- a/hw/net/e1000.c
> +++ b/hw/net/e1000.c
> @@ -1198,7 +1198,7 @@ static const VMStateDescription vmstate_e1000 = {
>      .pre_save = e1000_pre_save,
>      .post_load = e1000_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, E1000State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UNUSED_TEST(is_version_1, 4), /* was instance id */
>          VMSTATE_UNUSED(4), /* Was mmio_base.  */
>          VMSTATE_UINT32(rxbuf_size, E1000State),
> diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
> index e0befb2..f3def09 100644
> --- a/hw/net/eepro100.c
> +++ b/hw/net/eepro100.c
> @@ -1786,7 +1786,7 @@ static const VMStateDescription vmstate_eepro100 = {
>      .minimum_version_id = 2,
>      .minimum_version_id_old = 2,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, EEPRO100State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UNUSED(32),
>          VMSTATE_BUFFER(mult, EEPRO100State),
>          VMSTATE_BUFFER(mem, EEPRO100State),
> diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
> index 8d43fd9..d7ca182 100644
> --- a/hw/net/ne2000.c
> +++ b/hw/net/ne2000.c
> @@ -647,7 +647,7 @@ static const VMStateDescription vmstate_pci_ne2000 = {
>      .minimum_version_id = 3,
>      .minimum_version_id_old = 3,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, PCINE2000State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(ne2000, PCINE2000State, 0, vmstate_ne2000, NE2000State),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
> index 6ef28f7..cb9f361 100644
> --- a/hw/net/pcnet-pci.c
> +++ b/hw/net/pcnet-pci.c
> @@ -243,7 +243,7 @@ static const VMStateDescription vmstate_pci_pcnet = {
>      .minimum_version_id = 2,
>      .minimum_version_id_old = 2,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PCIPCNetState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(state, PCIPCNetState, 0, vmstate_pcnet, PCNetState),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
> index 6552034..283d02d 100644
> --- a/hw/net/rtl8139.c
> +++ b/hw/net/rtl8139.c
> @@ -3292,7 +3292,7 @@ static const VMStateDescription vmstate_rtl8139 = {
>      .post_load = rtl8139_post_load,
>      .pre_save  = rtl8139_pre_save,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, RTL8139State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_PARTIAL_BUFFER(phys, RTL8139State, 6),
>          VMSTATE_BUFFER(mult, RTL8139State),
>          VMSTATE_UINT32_ARRAY(TxStatus, RTL8139State, 4),
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index b39ff08..3bad83c 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -2378,7 +2378,7 @@ static const VMStateDescription vmstate_vmxnet3 = {
>      .pre_save = vmxnet3_pre_save,
>      .post_load = vmxnet3_post_load,
>      .fields      = (VMStateField[]) {
> -            VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State),
> +            VMSTATE_PCI_DEVICE(),
>              VMSTATE_BOOL(rx_packets_compound, VMXNET3State),
>              VMSTATE_BOOL(rx_vlan_stripping, VMXNET3State),
>              VMSTATE_BOOL(lro_supported, VMXNET3State),
> diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
> index cf3c53c..a909dbf 100644
> --- a/hw/pci-bridge/pci_bridge_dev.c
> +++ b/hw/pci-bridge/pci_bridge_dev.c
> @@ -126,7 +126,7 @@ static Property pci_bridge_dev_properties[] = {
>  static const VMStateDescription pci_bridge_dev_vmstate = {
>      .name = "pci_bridge",
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
> +        VMSTATE_PCI_DEVICE(),
>          SHPC_VMSTATE(shpc, PCIDevice),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index 5086d42..1b82df4 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -689,7 +689,7 @@ static const VMStateDescription vmstate_bonito = {
>      .minimum_version_id = 1,
>      .minimum_version_id_old = 1,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, PCIBonitoState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_END_OF_LIST()
>      }
>  };
> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> index 3908860..982f29c 100644
> --- a/hw/pci-host/piix.c
> +++ b/hw/pci-host/piix.c
> @@ -197,7 +197,7 @@ static const VMStateDescription vmstate_i440fx = {
>      .load_state_old = i440fx_load_old,
>      .post_load = i440fx_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT8(smm_enabled, PCII440FXState),
>          VMSTATE_END_OF_LIST()
>      }
> @@ -516,7 +516,7 @@ static const VMStateDescription vmstate_piix3 = {
>      .post_load = piix3_post_load,
>      .pre_save = piix3_pre_save,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, PIIX3State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
>                                PIIX_NUM_PIRQS, 3),
>          VMSTATE_END_OF_LIST()
> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
> index b41d564..f6582ea 100644
> --- a/hw/pci-host/prep.c
> +++ b/hw/pci-host/prep.c
> @@ -179,7 +179,7 @@ static const VMStateDescription vmstate_raven = {
>      .version_id = 0,
>      .minimum_version_id = 0,
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(dev, RavenPCIState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_END_OF_LIST()
>      },
>  };
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index 6b1b3b7..1f0b5db 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -230,7 +230,7 @@ static const VMStateDescription vmstate_mch = {
>      .minimum_version_id_old = 1,
>      .post_load = mch_post_load,
>      .fields = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, MCHPCIState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT8(smm_enabled, MCHPCIState),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
> index 2ac21d4..76b8cfa 100644
> --- a/hw/scsi/esp-pci.c
> +++ b/hw/scsi/esp-pci.c
> @@ -312,7 +312,7 @@ static const VMStateDescription vmstate_esp_pci_scsi = {
>      .minimum_version_id = 0,
>      .minimum_version_id_old = 0,
>      .fields = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
>          VMSTATE_STRUCT(esp, PCIESPState, 0, vmstate_esp, ESPState),
>          VMSTATE_END_OF_LIST()
> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
> index 776e31a..f723f26 100644
> --- a/hw/scsi/lsi53c895a.c
> +++ b/hw/scsi/lsi53c895a.c
> @@ -1996,7 +1996,7 @@ static const VMStateDescription vmstate_lsi_scsi = {
>      .minimum_version_id_old = 0,
>      .pre_save = lsi_pre_save,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, LSIState),
> +        VMSTATE_PCI_DEVICE(),
>  
>          VMSTATE_INT32(carry, LSIState),
>          VMSTATE_INT32(status, LSIState),
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index eb52164..8cb6714 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -2061,7 +2061,7 @@ static const VMStateDescription vmstate_megasas = {
>      .minimum_version_id = 0,
>      .minimum_version_id_old = 0,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(parent_obj, MegasasState),
> +        VMSTATE_PCI_DEVICE(),
>  
>          VMSTATE_INT32(fw_state, MegasasState),
>          VMSTATE_INT32(intr_mask, MegasasState),
> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
> index e1074e1..7e9ea39 100644
> --- a/hw/scsi/vmw_pvscsi.c
> +++ b/hw/scsi/vmw_pvscsi.c
> @@ -1143,7 +1143,7 @@ static const VMStateDescription vmstate_pvscsi = {
>      .pre_save = pvscsi_pre_save,
>      .post_load = pvscsi_post_load,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PVSCSIState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT8(msi_used, PVSCSIState),
>          VMSTATE_UINT32(resetting, PVSCSIState),
>          VMSTATE_UINT64(reg_interrupt_status, PVSCSIState),
> diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
> index 5d229bc..385745e 100644
> --- a/hw/usb/hcd-ehci-pci.c
> +++ b/hw/usb/hcd-ehci-pci.c
> @@ -109,7 +109,7 @@ static const VMStateDescription vmstate_ehci_pci = {
>      .version_id  = 2,
>      .minimum_version_id  = 1,
>      .fields      = (VMStateField[]) {
> -        VMSTATE_PCI_DEVICE(pcidev, EHCIPCIState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_STRUCT(ehci, EHCIPCIState, 2, vmstate_ehci, EHCIState),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
> index 066072e..d9170f7 100644
> --- a/hw/usb/hcd-uhci.c
> +++ b/hw/usb/hcd-uhci.c
> @@ -444,7 +444,7 @@ static const VMStateDescription vmstate_uhci = {
>      .minimum_version_id_old = 1,
>      .post_load = uhci_post_load,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, UHCIState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState),
>          VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,
>                               vmstate_uhci_port, UHCIPort),
> diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
> index 85aebc2..bfe19dd 100644
> --- a/hw/watchdog/wdt_i6300esb.c
> +++ b/hw/watchdog/wdt_i6300esb.c
> @@ -391,7 +391,7 @@ static const VMStateDescription vmstate_i6300esb = {
>      .minimum_version_id = 1,
>      .minimum_version_id_old = 1,
>      .fields      = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(dev, I6300State),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_INT32(reboot_enabled, I6300State),
>          VMSTATE_INT32(clock_scale, I6300State),
>          VMSTATE_INT32(int_type, I6300State),
> diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
> index 6a8ba7e..5f2d2b6 100644
> --- a/hw/xen/xen_platform.c
> +++ b/hw/xen/xen_platform.c
> @@ -377,7 +377,7 @@ static const VMStateDescription vmstate_xen_platform = {
>      .minimum_version_id_old = 4,
>      .post_load = xen_platform_post_load,
>      .fields = (VMStateField []) {
> -        VMSTATE_PCI_DEVICE(parent_obj, PCIXenPlatformState),
> +        VMSTATE_PCI_DEVICE(),
>          VMSTATE_UINT8(flags, PCIXenPlatformState),
>          VMSTATE_END_OF_LIST()
>      }
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index ccec2ba..5997d91 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -710,12 +710,12 @@ static inline void pci_dma_sglist_init(QEMUSGList *qsg, PCIDevice *dev,
>  
>  extern const VMStateDescription vmstate_pci_device;
>  
> -#define VMSTATE_PCI_DEVICE(_field, _state) {                         \
> -    .name       = (stringify(_field)),                               \
> +#define VMSTATE_PCI_DEVICE() {                                       \
> +    .name       = "parent_obj",                                      \
>      .size       = sizeof(PCIDevice),                                 \
>      .vmsd       = &vmstate_pci_device,                               \
>      .flags      = VMS_STRUCT,                                        \
> -    .offset     = vmstate_offset_value(_state, _field, PCIDevice),   \
> +    .offset     = 0,                                                 \
>  }
>  
>  #define VMSTATE_PCI_DEVICE_POINTER(_field, _state) {                 \
> -- 
> 1.8.1.4

Patch

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index c885690..c95d0b4 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -294,7 +294,7 @@  static const VMStateDescription vmstate_acpi = {
     .load_state_old = acpi_load_old,
     .post_load = vmstate_acpi_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT16(ar.pm1.evt.sts, PIIX4PMState),
         VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
         VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState),
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 365b2f1..d23882b 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -1214,7 +1214,7 @@  static const VMStateDescription vmstate_ac97 = {
     .minimum_version_id_old = 2,
     .post_load = ac97_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE (dev, AC97LinkState),
+        VMSTATE_PCI_DEVICE (),
         VMSTATE_UINT32 (glob_cnt, AC97LinkState),
         VMSTATE_UINT32 (glob_sta, AC97LinkState),
         VMSTATE_UINT32 (cas, AC97LinkState),
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index f2c40da..d681a44 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -1000,7 +1000,7 @@  static const VMStateDescription vmstate_es1370 = {
     .minimum_version_id_old = 2,
     .post_load = es1370_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE (dev, ES1370State),
+        VMSTATE_PCI_DEVICE (),
         VMSTATE_STRUCT_ARRAY (chan, ES1370State, NB_CHANNELS, 2,
                               vmstate_es1370_channel, struct chan),
         VMSTATE_UINT32 (ctl, ES1370State),
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 58984dc..fb7f8ef 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -1191,7 +1191,7 @@  static const VMStateDescription vmstate_intel_hda = {
     .version_id = 1,
     .post_load = intel_hda_post_load,
     .fields = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(pci, IntelHDAState),
+        VMSTATE_PCI_DEVICE(),
 
         /* registers */
         VMSTATE_UINT32(g_ctl, IntelHDAState),
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index a17c702..f6a21af 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -155,7 +155,7 @@  static const VMStateDescription vmstate_pci_serial = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, PCISerialState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(state, PCISerialState, 0, vmstate_serial, SerialState),
         VMSTATE_END_OF_LIST()
     }
@@ -166,7 +166,7 @@  static const VMStateDescription vmstate_pci_multi_serial = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, PCIMultiSerialState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT_ARRAY(state, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS,
                              0, vmstate_serial, SerialState),
         VMSTATE_UINT32_ARRAY(level, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS),
diff --git a/hw/char/tpci200.c b/hw/char/tpci200.c
index a199e57..2ba5ad2 100644
--- a/hw/char/tpci200.c
+++ b/hw/char/tpci200.c
@@ -631,7 +631,7 @@  static const VMStateDescription vmstate_tpci200 = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, TPCI200State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_BOOL_ARRAY(big_endian, TPCI200State, 3),
         VMSTATE_UINT8_ARRAY(ctrl, TPCI200State, N_MODULES),
         VMSTATE_UINT16(status, TPCI200State),
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index a440575..c116bc4 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -2746,7 +2746,7 @@  static const VMStateDescription vmstate_pci_cirrus_vga = {
     .minimum_version_id = 2,
     .minimum_version_id_old = 2,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, PCICirrusVGAState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(cirrus_vga, PCICirrusVGAState, 0,
                        vmstate_cirrus_vga, CirrusVGAState),
         VMSTATE_END_OF_LIST()
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index ddefa06..813c31a 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2265,7 +2265,7 @@  static VMStateDescription qxl_vmstate = {
     .pre_load           = qxl_pre_load,
     .post_load          = qxl_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(pci, PCIQXLDevice),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(vga, PCIQXLDevice, 0, vmstate_vga_common, VGACommonState),
         VMSTATE_UINT32(shadow_rom.mode, PCIQXLDevice),
         VMSTATE_UINT32(num_free_res, PCIQXLDevice),
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 3e150ab..ce76e9c 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -56,7 +56,7 @@  static const VMStateDescription vmstate_vga_pci = {
     .minimum_version_id = 2,
     .minimum_version_id_old = 2,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, PCIVGAState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 3536cde..97c7ba1 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -1179,7 +1179,7 @@  static const VMStateDescription vmstate_vmware_vga = {
     .minimum_version_id = 0,
     .minimum_version_id_old = 0,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(parent_obj, struct pci_vmsvga_state_s),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(chip, struct pci_vmsvga_state_s, 0,
                        vmstate_vmware_vga_internal, struct vmsvga_state_s),
         VMSTATE_END_OF_LIST()
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index ca22978..c2ac696 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -50,7 +50,7 @@  static const VMStateDescription vmstate_ich9_smbus = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, struct ICH9SMBState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 4eb5488..bf16847 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -84,7 +84,7 @@  static const VMStateDescription vmstate_ich9_ahci = {
     .unmigratable = 1, /* Still buggy under I/O load */
     .version_id = 1,
     .fields = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, AHCIPCIState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_AHCI(ahci, AHCIPCIState),
         VMSTATE_END_OF_LIST()
     },
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 91151fc..a3ede4f 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -482,7 +482,7 @@  const VMStateDescription vmstate_ide_pci = {
     .minimum_version_id_old = 0,
     .post_load = ide_pci_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCIIDEState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT_ARRAY(bmdma, PCIIDEState, 2, 0,
                              vmstate_bmdma, BMDMAState),
         VMSTATE_IDE_BUS_ARRAY(bus, PCIIDEState, 2),
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index b25ed04..b147b82 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -54,7 +54,7 @@  static const VMStateDescription vmstate_pci_i82378 = {
     .version_id = 0,
     .minimum_version_id = 0,
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(pci_dev, PCIi82378State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_END_OF_LIST()
     },
 };
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index d1921aa..5a9fd03 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -579,7 +579,7 @@  static const VMStateDescription vmstate_ich9_lpc = {
     .minimum_version_id_old = 1,
     .post_load = ich9_lpc_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(d, ICH9LPCState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(apm, ICH9LPCState, 0, vmstate_apm, APMState),
         VMSTATE_STRUCT(pm, ICH9LPCState, 0, vmstate_ich9_pm, ICH9LPCPMRegs),
         VMSTATE_UINT8_ARRAY(chip_config, ICH9LPCState, ICH9_CC_SIZE),
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 1a1d451..fe13429 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -78,7 +78,7 @@  static const VMStateDescription vmstate_piix4 = {
     .minimum_version_id = 2,
     .minimum_version_id_old = 2,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, PIIX4State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 2174eaa..72e2dfd 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -233,7 +233,7 @@  static const VMStateDescription vmstate_acpi = {
     .minimum_version_id_old = 1,
     .post_load = vmstate_acpi_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, VT686PMState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT16(ar.pm1.evt.sts, VT686PMState),
         VMSTATE_UINT16(ar.pm1.evt.en, VT686PMState),
         VMSTATE_UINT16(ar.pm1.cnt.cnt, VT686PMState),
@@ -417,7 +417,7 @@  static const VMStateDescription vmstate_via = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, VT82C686BState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index b952d8d..a2f3c70 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1198,7 +1198,7 @@  static const VMStateDescription vmstate_e1000 = {
     .pre_save = e1000_pre_save,
     .post_load = e1000_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, E1000State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UNUSED_TEST(is_version_1, 4), /* was instance id */
         VMSTATE_UNUSED(4), /* Was mmio_base.  */
         VMSTATE_UINT32(rxbuf_size, E1000State),
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index e0befb2..f3def09 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -1786,7 +1786,7 @@  static const VMStateDescription vmstate_eepro100 = {
     .minimum_version_id = 2,
     .minimum_version_id_old = 2,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, EEPRO100State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UNUSED(32),
         VMSTATE_BUFFER(mult, EEPRO100State),
         VMSTATE_BUFFER(mem, EEPRO100State),
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index 8d43fd9..d7ca182 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -647,7 +647,7 @@  static const VMStateDescription vmstate_pci_ne2000 = {
     .minimum_version_id = 3,
     .minimum_version_id_old = 3,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, PCINE2000State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(ne2000, PCINE2000State, 0, vmstate_ne2000, NE2000State),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 6ef28f7..cb9f361 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -243,7 +243,7 @@  static const VMStateDescription vmstate_pci_pcnet = {
     .minimum_version_id = 2,
     .minimum_version_id_old = 2,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCIPCNetState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(state, PCIPCNetState, 0, vmstate_pcnet, PCNetState),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 6552034..283d02d 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -3292,7 +3292,7 @@  static const VMStateDescription vmstate_rtl8139 = {
     .post_load = rtl8139_post_load,
     .pre_save  = rtl8139_pre_save,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, RTL8139State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_PARTIAL_BUFFER(phys, RTL8139State, 6),
         VMSTATE_BUFFER(mult, RTL8139State),
         VMSTATE_UINT32_ARRAY(TxStatus, RTL8139State, 4),
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index b39ff08..3bad83c 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2378,7 +2378,7 @@  static const VMStateDescription vmstate_vmxnet3 = {
     .pre_save = vmxnet3_pre_save,
     .post_load = vmxnet3_post_load,
     .fields      = (VMStateField[]) {
-            VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State),
+            VMSTATE_PCI_DEVICE(),
             VMSTATE_BOOL(rx_packets_compound, VMXNET3State),
             VMSTATE_BOOL(rx_vlan_stripping, VMXNET3State),
             VMSTATE_BOOL(lro_supported, VMXNET3State),
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index cf3c53c..a909dbf 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -126,7 +126,7 @@  static Property pci_bridge_dev_properties[] = {
 static const VMStateDescription pci_bridge_dev_vmstate = {
     .name = "pci_bridge",
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
+        VMSTATE_PCI_DEVICE(),
         SHPC_VMSTATE(shpc, PCIDevice),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 5086d42..1b82df4 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -689,7 +689,7 @@  static const VMStateDescription vmstate_bonito = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, PCIBonitoState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 3908860..982f29c 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -197,7 +197,7 @@  static const VMStateDescription vmstate_i440fx = {
     .load_state_old = i440fx_load_old,
     .post_load = i440fx_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT8(smm_enabled, PCII440FXState),
         VMSTATE_END_OF_LIST()
     }
@@ -516,7 +516,7 @@  static const VMStateDescription vmstate_piix3 = {
     .post_load = piix3_post_load,
     .pre_save = piix3_pre_save,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, PIIX3State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
                               PIIX_NUM_PIRQS, 3),
         VMSTATE_END_OF_LIST()
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index b41d564..f6582ea 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -179,7 +179,7 @@  static const VMStateDescription vmstate_raven = {
     .version_id = 0,
     .minimum_version_id = 0,
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(dev, RavenPCIState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_END_OF_LIST()
     },
 };
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 6b1b3b7..1f0b5db 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -230,7 +230,7 @@  static const VMStateDescription vmstate_mch = {
     .minimum_version_id_old = 1,
     .post_load = mch_post_load,
     .fields = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, MCHPCIState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT8(smm_enabled, MCHPCIState),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 2ac21d4..76b8cfa 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -312,7 +312,7 @@  static const VMStateDescription vmstate_esp_pci_scsi = {
     .minimum_version_id = 0,
     .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
         VMSTATE_STRUCT(esp, PCIESPState, 0, vmstate_esp, ESPState),
         VMSTATE_END_OF_LIST()
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 776e31a..f723f26 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -1996,7 +1996,7 @@  static const VMStateDescription vmstate_lsi_scsi = {
     .minimum_version_id_old = 0,
     .pre_save = lsi_pre_save,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, LSIState),
+        VMSTATE_PCI_DEVICE(),
 
         VMSTATE_INT32(carry, LSIState),
         VMSTATE_INT32(status, LSIState),
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index eb52164..8cb6714 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2061,7 +2061,7 @@  static const VMStateDescription vmstate_megasas = {
     .minimum_version_id = 0,
     .minimum_version_id_old = 0,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(parent_obj, MegasasState),
+        VMSTATE_PCI_DEVICE(),
 
         VMSTATE_INT32(fw_state, MegasasState),
         VMSTATE_INT32(intr_mask, MegasasState),
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index e1074e1..7e9ea39 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1143,7 +1143,7 @@  static const VMStateDescription vmstate_pvscsi = {
     .pre_save = pvscsi_pre_save,
     .post_load = pvscsi_post_load,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(parent_obj, PVSCSIState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT8(msi_used, PVSCSIState),
         VMSTATE_UINT32(resetting, PVSCSIState),
         VMSTATE_UINT64(reg_interrupt_status, PVSCSIState),
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 5d229bc..385745e 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -109,7 +109,7 @@  static const VMStateDescription vmstate_ehci_pci = {
     .version_id  = 2,
     .minimum_version_id  = 1,
     .fields      = (VMStateField[]) {
-        VMSTATE_PCI_DEVICE(pcidev, EHCIPCIState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_STRUCT(ehci, EHCIPCIState, 2, vmstate_ehci, EHCIState),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 066072e..d9170f7 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -444,7 +444,7 @@  static const VMStateDescription vmstate_uhci = {
     .minimum_version_id_old = 1,
     .post_load = uhci_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, UHCIState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState),
         VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,
                              vmstate_uhci_port, UHCIPort),
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 85aebc2..bfe19dd 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -391,7 +391,7 @@  static const VMStateDescription vmstate_i6300esb = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(dev, I6300State),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_INT32(reboot_enabled, I6300State),
         VMSTATE_INT32(clock_scale, I6300State),
         VMSTATE_INT32(int_type, I6300State),
diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
index 6a8ba7e..5f2d2b6 100644
--- a/hw/xen/xen_platform.c
+++ b/hw/xen/xen_platform.c
@@ -377,7 +377,7 @@  static const VMStateDescription vmstate_xen_platform = {
     .minimum_version_id_old = 4,
     .post_load = xen_platform_post_load,
     .fields = (VMStateField []) {
-        VMSTATE_PCI_DEVICE(parent_obj, PCIXenPlatformState),
+        VMSTATE_PCI_DEVICE(),
         VMSTATE_UINT8(flags, PCIXenPlatformState),
         VMSTATE_END_OF_LIST()
     }
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index ccec2ba..5997d91 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -710,12 +710,12 @@  static inline void pci_dma_sglist_init(QEMUSGList *qsg, PCIDevice *dev,
 
 extern const VMStateDescription vmstate_pci_device;
 
-#define VMSTATE_PCI_DEVICE(_field, _state) {                         \
-    .name       = (stringify(_field)),                               \
+#define VMSTATE_PCI_DEVICE() {                                       \
+    .name       = "parent_obj",                                      \
     .size       = sizeof(PCIDevice),                                 \
     .vmsd       = &vmstate_pci_device,                               \
     .flags      = VMS_STRUCT,                                        \
-    .offset     = vmstate_offset_value(_state, _field, PCIDevice),   \
+    .offset     = 0,                                                 \
 }
 
 #define VMSTATE_PCI_DEVICE_POINTER(_field, _state) {                 \