Skip to content

Commit

Permalink
migration: Use vmstate_register_any()
Browse files Browse the repository at this point in the history
This are the easiest cases, where we were already using
VMSTATE_INSTANCE_ID_ANY.

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231020090731.28701-3-quintela@redhat.com>
  • Loading branch information
Juan Quintela committed Oct 24, 2023
1 parent 9d3e584 commit dd9b858
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions backends/dbus-vmstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,7 @@ dbus_vmstate_complete(UserCreatable *uc, Error **errp)
return;
}

if (vmstate_register(VMSTATE_IF(self), VMSTATE_INSTANCE_ID_ANY,
&dbus_vmstate, self) < 0) {
if (vmstate_register_any(VMSTATE_IF(self), &dbus_vmstate, self) < 0) {
error_setg(errp, "Failed to register vmstate");
}
}
Expand Down
3 changes: 1 addition & 2 deletions backends/tpm/tpm_emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,7 @@ static void tpm_emulator_inst_init(Object *obj)
qemu_add_vm_change_state_handler(tpm_emulator_vm_state_change,
tpm_emu);

vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY,
&vmstate_tpm_emulator, obj);
vmstate_register_any(NULL, &vmstate_tpm_emulator, obj);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion hw/i2c/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ I2CBus *i2c_init_bus(DeviceState *parent, const char *name)
bus = I2C_BUS(qbus_new(TYPE_I2C_BUS, parent, name));
QLIST_INIT(&bus->current_devs);
QSIMPLEQ_INIT(&bus->pending_masters);
vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_i2c_bus, bus);
vmstate_register_any(NULL, &vmstate_i2c_bus, bus);
return bus;
}

Expand Down
2 changes: 1 addition & 1 deletion hw/input/adb.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static void adb_bus_realize(BusState *qbus, Error **errp)
adb_bus->autopoll_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, adb_autopoll,
adb_bus);

vmstate_register(NULL, -1, &vmstate_adb_bus, adb_bus);
vmstate_register_any(NULL, &vmstate_adb_bus, adb_bus);
}

static void adb_bus_unrealize(BusState *qbus)
Expand Down
2 changes: 1 addition & 1 deletion hw/input/ads7846.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static void ads7846_realize(SSIPeripheral *d, Error **errp)

ads7846_int_update(s);

vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_ads7846, s);
vmstate_register_any(NULL, &vmstate_ads7846, s);
}

static void ads7846_class_init(ObjectClass *klass, void *data)
Expand Down
3 changes: 1 addition & 2 deletions hw/input/stellaris_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,5 @@ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode)
}
s->num_buttons = n;
qemu_add_kbd_event_handler(stellaris_gamepad_put_key, s);
vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY,
&vmstate_stellaris_gamepad, s);
vmstate_register_any(NULL, &vmstate_stellaris_gamepad, s);
}
3 changes: 1 addition & 2 deletions hw/net/eepro100.c
Original file line number Diff line number Diff line change
Expand Up @@ -1883,8 +1883,7 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp)

s->vmstate = g_memdup(&vmstate_eepro100, sizeof(vmstate_eepro100));
s->vmstate->name = qemu_get_queue(s->nic)->model;
vmstate_register(VMSTATE_IF(&pci_dev->qdev), VMSTATE_INSTANCE_ID_ANY,
s->vmstate, s);
vmstate_register_any(VMSTATE_IF(&pci_dev->qdev), s->vmstate, s);
}

static void eepro100_instance_init(Object *obj)
Expand Down
2 changes: 1 addition & 1 deletion hw/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void pci_bus_realize(BusState *qbus, Error **errp)
bus->machine_done.notify = pcibus_machine_done;
qemu_add_machine_init_done_notifier(&bus->machine_done);

vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_pcibus, bus);
vmstate_register_any(NULL, &vmstate_pcibus, bus);
}

static void pcie_bus_realize(BusState *qbus, Error **errp)
Expand Down
3 changes: 1 addition & 2 deletions hw/ppc/spapr_nvdimm.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,7 @@ static void spapr_nvdimm_realize(NVDIMMDevice *dimm, Error **errp)
s_nvdimm->hcall_flush_required = true;
}

vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY,
&vmstate_spapr_nvdimm_states, dimm);
vmstate_register_any(NULL, &vmstate_spapr_nvdimm_states, dimm);
}

static void spapr_nvdimm_unrealize(NVDIMMDevice *dimm)
Expand Down
2 changes: 1 addition & 1 deletion hw/timer/arm_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static arm_timer_state *arm_timer_init(uint32_t freq)
s->control = TIMER_CTRL_IE;

s->timer = ptimer_init(arm_timer_tick, s, PTIMER_POLICY_LEGACY);
vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_arm_timer, s);
vmstate_register_any(NULL, &vmstate_arm_timer, s);
return s;
}

Expand Down
4 changes: 2 additions & 2 deletions hw/virtio/virtio-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,8 +1119,8 @@ static void virtio_mem_device_realize(DeviceState *dev, Error **errp)
host_memory_backend_set_mapped(vmem->memdev, true);
vmstate_register_ram(&vmem->memdev->mr, DEVICE(vmem));
if (vmem->early_migration) {
vmstate_register(VMSTATE_IF(vmem), VMSTATE_INSTANCE_ID_ANY,
&vmstate_virtio_mem_device_early, vmem);
vmstate_register_any(VMSTATE_IF(vmem),
&vmstate_virtio_mem_device_early, vmem);
}
qemu_register_reset(virtio_mem_system_reset, vmem);

Expand Down

0 comments on commit dd9b858

Please sign in to comment.