hw/input: Constify VMState

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231221031652.119827-34-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2023-12-21 14:16:14 +11:00
parent 8595c05422
commit af0f07dfc7
15 changed files with 30 additions and 30 deletions

View File

@ -332,7 +332,7 @@ static const VMStateDescription vmstate_adb_kbd = {
.name = "adb_kbd", .name = "adb_kbd",
.version_id = 2, .version_id = 2,
.minimum_version_id = 2, .minimum_version_id = 2,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT(parent_obj, KBDState, 0, vmstate_adb_device, ADBDevice), VMSTATE_STRUCT(parent_obj, KBDState, 0, vmstate_adb_device, ADBDevice),
VMSTATE_BUFFER(data, KBDState), VMSTATE_BUFFER(data, KBDState),
VMSTATE_INT32(rptr, KBDState), VMSTATE_INT32(rptr, KBDState),

View File

@ -217,7 +217,7 @@ static const VMStateDescription vmstate_adb_mouse = {
.name = "adb_mouse", .name = "adb_mouse",
.version_id = 2, .version_id = 2,
.minimum_version_id = 2, .minimum_version_id = 2,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT(parent_obj, MouseState, 0, vmstate_adb_device, VMSTATE_STRUCT(parent_obj, MouseState, 0, vmstate_adb_device,
ADBDevice), ADBDevice),
VMSTATE_INT32(buttons_state, MouseState), VMSTATE_INT32(buttons_state, MouseState),

View File

@ -221,7 +221,7 @@ static const VMStateDescription vmstate_adb_bus = {
.name = "adb_bus", .name = "adb_bus",
.version_id = 0, .version_id = 0,
.minimum_version_id = 0, .minimum_version_id = 0,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_TIMER_PTR(autopoll_timer, ADBBusState), VMSTATE_TIMER_PTR(autopoll_timer, ADBBusState),
VMSTATE_BOOL(autopoll_enabled, ADBBusState), VMSTATE_BOOL(autopoll_enabled, ADBBusState),
VMSTATE_UINT8(autopoll_rate_ms, ADBBusState), VMSTATE_UINT8(autopoll_rate_ms, ADBBusState),
@ -279,7 +279,7 @@ const VMStateDescription vmstate_adb_device = {
.name = "adb_device", .name = "adb_device",
.version_id = 0, .version_id = 0,
.minimum_version_id = 0, .minimum_version_id = 0,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_INT32(devaddr, ADBDevice), VMSTATE_INT32(devaddr, ADBDevice),
VMSTATE_INT32(handler, ADBDevice), VMSTATE_INT32(handler, ADBDevice),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()

View File

@ -130,7 +130,7 @@ static const VMStateDescription vmstate_ads7846 = {
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.post_load = ads7856_post_load, .post_load = ads7856_post_load,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_SSI_PERIPHERAL(ssidev, ADS7846State), VMSTATE_SSI_PERIPHERAL(ssidev, ADS7846State),
VMSTATE_INT32_ARRAY(input, ADS7846State, 8), VMSTATE_INT32_ARRAY(input, ADS7846State, 8),
VMSTATE_INT32(noise, ADS7846State), VMSTATE_INT32(noise, ADS7846State),

View File

@ -581,7 +581,7 @@ static const VMStateDescription vmstate_hid_ptr_queue = {
.name = "HIDPointerEventQueue", .name = "HIDPointerEventQueue",
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_INT32(xdx, HIDPointerEvent), VMSTATE_INT32(xdx, HIDPointerEvent),
VMSTATE_INT32(ydy, HIDPointerEvent), VMSTATE_INT32(ydy, HIDPointerEvent),
VMSTATE_INT32(dz, HIDPointerEvent), VMSTATE_INT32(dz, HIDPointerEvent),
@ -595,7 +595,7 @@ const VMStateDescription vmstate_hid_ptr_device = {
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.post_load = hid_post_load, .post_load = hid_post_load,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT_ARRAY(ptr.queue, HIDState, QUEUE_LENGTH, 0, VMSTATE_STRUCT_ARRAY(ptr.queue, HIDState, QUEUE_LENGTH, 0,
vmstate_hid_ptr_queue, HIDPointerEvent), vmstate_hid_ptr_queue, HIDPointerEvent),
VMSTATE_UINT32(head, HIDState), VMSTATE_UINT32(head, HIDState),
@ -611,7 +611,7 @@ const VMStateDescription vmstate_hid_keyboard_device = {
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.post_load = hid_post_load, .post_load = hid_post_load,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(kbd.keycodes, HIDState, QUEUE_LENGTH), VMSTATE_UINT32_ARRAY(kbd.keycodes, HIDState, QUEUE_LENGTH),
VMSTATE_UINT32(head, HIDState), VMSTATE_UINT32(head, HIDState),
VMSTATE_UINT32(n, HIDState), VMSTATE_UINT32(n, HIDState),

View File

@ -39,7 +39,7 @@ static const VMStateDescription vmstate_lasips2_port = {
.name = "lasips2-port", .name = "lasips2-port",
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT8(control, LASIPS2Port), VMSTATE_UINT8(control, LASIPS2Port),
VMSTATE_UINT8(buf, LASIPS2Port), VMSTATE_UINT8(buf, LASIPS2Port),
VMSTATE_BOOL(loopback_rbne, LASIPS2Port), VMSTATE_BOOL(loopback_rbne, LASIPS2Port),
@ -51,7 +51,7 @@ static const VMStateDescription vmstate_lasips2 = {
.name = "lasips2", .name = "lasips2",
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT8(int_status, LASIPS2State), VMSTATE_UINT8(int_status, LASIPS2State),
VMSTATE_STRUCT(kbd_port.parent_obj, LASIPS2State, 1, VMSTATE_STRUCT(kbd_port.parent_obj, LASIPS2State, 1,
vmstate_lasips2_port, LASIPS2Port), vmstate_lasips2_port, LASIPS2Port),

View File

@ -441,7 +441,7 @@ static const VMStateDescription vmstate_lm_kbd = {
.version_id = 0, .version_id = 0,
.minimum_version_id = 0, .minimum_version_id = 0,
.post_load = lm_kbd_post_load, .post_load = lm_kbd_post_load,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_I2C_SLAVE(parent_obj, LM823KbdState), VMSTATE_I2C_SLAVE(parent_obj, LM823KbdState),
VMSTATE_UINT8(i2c_dir, LM823KbdState), VMSTATE_UINT8(i2c_dir, LM823KbdState),
VMSTATE_UINT8(i2c_cycle, LM823KbdState), VMSTATE_UINT8(i2c_cycle, LM823KbdState),

View File

@ -510,7 +510,7 @@ static const VMStateDescription vmstate_kbd_outport = {
.minimum_version_id = 1, .minimum_version_id = 1,
.post_load = kbd_outport_post_load, .post_load = kbd_outport_post_load,
.needed = kbd_outport_needed, .needed = kbd_outport_needed,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT8(outport, KBDState), VMSTATE_UINT8(outport, KBDState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
} }
@ -552,7 +552,7 @@ static const VMStateDescription vmstate_kbd_extended_state = {
.post_load = kbd_extended_state_post_load, .post_load = kbd_extended_state_post_load,
.pre_save = kbd_extended_state_pre_save, .pre_save = kbd_extended_state_pre_save,
.needed = kbd_extended_state_needed, .needed = kbd_extended_state_needed,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT32(migration_flags, KBDState), VMSTATE_UINT32(migration_flags, KBDState),
VMSTATE_UINT32(obsrc, KBDState), VMSTATE_UINT32(obsrc, KBDState),
VMSTATE_UINT8(obdata, KBDState), VMSTATE_UINT8(obdata, KBDState),
@ -619,14 +619,14 @@ static const VMStateDescription vmstate_kbd = {
.pre_load = kbd_pre_load, .pre_load = kbd_pre_load,
.post_load = kbd_post_load, .post_load = kbd_post_load,
.pre_save = kbd_pre_save, .pre_save = kbd_pre_save,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT8(write_cmd, KBDState), VMSTATE_UINT8(write_cmd, KBDState),
VMSTATE_UINT8(status, KBDState), VMSTATE_UINT8(status, KBDState),
VMSTATE_UINT8(mode, KBDState), VMSTATE_UINT8(mode, KBDState),
VMSTATE_UINT8(pending_tmp, KBDState), VMSTATE_UINT8(pending_tmp, KBDState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
}, },
.subsections = (const VMStateDescription * []) { .subsections = (const VMStateDescription * const []) {
&vmstate_kbd_outport, &vmstate_kbd_outport,
&vmstate_kbd_extended_state, &vmstate_kbd_extended_state,
NULL NULL
@ -745,7 +745,7 @@ static const VMStateDescription vmstate_kbd_mmio = {
.name = "pckbd-mmio", .name = "pckbd-mmio",
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT(kbd, MMIOKBDState, 0, vmstate_kbd, KBDState), VMSTATE_STRUCT(kbd, MMIOKBDState, 0, vmstate_kbd, KBDState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
} }
@ -786,7 +786,7 @@ static const VMStateDescription vmstate_kbd_isa = {
.name = "pckbd", .name = "pckbd",
.version_id = 3, .version_id = 3,
.minimum_version_id = 3, .minimum_version_id = 3,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT(kbd, ISAKBDState, 0, vmstate_kbd, KBDState), VMSTATE_STRUCT(kbd, ISAKBDState, 0, vmstate_kbd, KBDState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
} }

View File

@ -30,7 +30,7 @@ static const VMStateDescription vmstate_pl050 = {
.name = "pl050", .name = "pl050",
.version_id = 2, .version_id = 2,
.minimum_version_id = 2, .minimum_version_id = 2,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT32(cr, PL050State), VMSTATE_UINT32(cr, PL050State),
VMSTATE_UINT32(clk, PL050State), VMSTATE_UINT32(clk, PL050State),
VMSTATE_UINT32(last, PL050State), VMSTATE_UINT32(last, PL050State),

View File

@ -1093,7 +1093,7 @@ static const VMStateDescription vmstate_ps2_common = {
.name = "PS2 Common State", .name = "PS2 Common State",
.version_id = 3, .version_id = 3,
.minimum_version_id = 2, .minimum_version_id = 2,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_INT32(write_cmd, PS2State), VMSTATE_INT32(write_cmd, PS2State),
VMSTATE_INT32(queue.rptr, PS2State), VMSTATE_INT32(queue.rptr, PS2State),
VMSTATE_INT32(queue.wptr, PS2State), VMSTATE_INT32(queue.wptr, PS2State),
@ -1124,7 +1124,7 @@ static const VMStateDescription vmstate_ps2_keyboard_ledstate = {
.minimum_version_id = 2, .minimum_version_id = 2,
.post_load = ps2_kbd_ledstate_post_load, .post_load = ps2_kbd_ledstate_post_load,
.needed = ps2_keyboard_ledstate_needed, .needed = ps2_keyboard_ledstate_needed,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_INT32(ledstate, PS2KbdState), VMSTATE_INT32(ledstate, PS2KbdState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
} }
@ -1141,7 +1141,7 @@ static const VMStateDescription vmstate_ps2_keyboard_need_high_bit = {
.version_id = 1, .version_id = 1,
.minimum_version_id = 1, .minimum_version_id = 1,
.needed = ps2_keyboard_need_high_bit_needed, .needed = ps2_keyboard_need_high_bit_needed,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_BOOL(need_high_bit, PS2KbdState), VMSTATE_BOOL(need_high_bit, PS2KbdState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
} }
@ -1158,7 +1158,7 @@ static bool ps2_keyboard_cqueue_needed(void *opaque)
static const VMStateDescription vmstate_ps2_keyboard_cqueue = { static const VMStateDescription vmstate_ps2_keyboard_cqueue = {
.name = "ps2kbd/command_reply_queue", .name = "ps2kbd/command_reply_queue",
.needed = ps2_keyboard_cqueue_needed, .needed = ps2_keyboard_cqueue_needed,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_INT32(parent_obj.queue.cwptr, PS2KbdState), VMSTATE_INT32(parent_obj.queue.cwptr, PS2KbdState),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
} }
@ -1183,7 +1183,7 @@ static const VMStateDescription vmstate_ps2_keyboard = {
.version_id = 3, .version_id = 3,
.minimum_version_id = 2, .minimum_version_id = 2,
.post_load = ps2_kbd_post_load, .post_load = ps2_kbd_post_load,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT(parent_obj, PS2KbdState, 0, vmstate_ps2_common, VMSTATE_STRUCT(parent_obj, PS2KbdState, 0, vmstate_ps2_common,
PS2State), PS2State),
VMSTATE_INT32(scan_enabled, PS2KbdState), VMSTATE_INT32(scan_enabled, PS2KbdState),
@ -1191,7 +1191,7 @@ static const VMStateDescription vmstate_ps2_keyboard = {
VMSTATE_INT32_V(scancode_set, PS2KbdState, 3), VMSTATE_INT32_V(scancode_set, PS2KbdState, 3),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
}, },
.subsections = (const VMStateDescription * []) { .subsections = (const VMStateDescription * const []) {
&vmstate_ps2_keyboard_ledstate, &vmstate_ps2_keyboard_ledstate,
&vmstate_ps2_keyboard_need_high_bit, &vmstate_ps2_keyboard_need_high_bit,
&vmstate_ps2_keyboard_cqueue, &vmstate_ps2_keyboard_cqueue,
@ -1214,7 +1214,7 @@ static const VMStateDescription vmstate_ps2_mouse = {
.version_id = 2, .version_id = 2,
.minimum_version_id = 2, .minimum_version_id = 2,
.post_load = ps2_mouse_post_load, .post_load = ps2_mouse_post_load,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_STRUCT(parent_obj, PS2MouseState, 0, vmstate_ps2_common, VMSTATE_STRUCT(parent_obj, PS2MouseState, 0, vmstate_ps2_common,
PS2State), PS2State),
VMSTATE_UINT8(mouse_status, PS2MouseState), VMSTATE_UINT8(mouse_status, PS2MouseState),

View File

@ -288,7 +288,7 @@ static const VMStateDescription vmstate_pxa2xx_keypad = {
.name = "pxa2xx_keypad", .name = "pxa2xx_keypad",
.version_id = 0, .version_id = 0,
.minimum_version_id = 0, .minimum_version_id = 0,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_UINT32(kpc, PXA2xxKeyPadState), VMSTATE_UINT32(kpc, PXA2xxKeyPadState),
VMSTATE_UINT32(kpdk, PXA2xxKeyPadState), VMSTATE_UINT32(kpdk, PXA2xxKeyPadState),
VMSTATE_UINT32(kprec, PXA2xxKeyPadState), VMSTATE_UINT32(kprec, PXA2xxKeyPadState),

View File

@ -35,7 +35,7 @@ static const VMStateDescription vmstate_stellaris_gamepad = {
.name = "stellaris_gamepad", .name = "stellaris_gamepad",
.version_id = 4, .version_id = 4,
.minimum_version_id = 4, .minimum_version_id = 4,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_VARRAY_UINT32(pressed, StellarisGamepad, num_buttons, VMSTATE_VARRAY_UINT32(pressed, StellarisGamepad, num_buttons,
0, vmstate_info_uint8, uint8_t), 0, vmstate_info_uint8, uint8_t),
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()

View File

@ -454,7 +454,7 @@ static const VMStateDescription vmstate_tsc2005 = {
.version_id = 2, .version_id = 2,
.minimum_version_id = 2, .minimum_version_id = 2,
.post_load = tsc2005_post_load, .post_load = tsc2005_post_load,
.fields = (VMStateField []) { .fields = (const VMStateField []) {
VMSTATE_BOOL(pressure, TSC2005State), VMSTATE_BOOL(pressure, TSC2005State),
VMSTATE_BOOL(irq, TSC2005State), VMSTATE_BOOL(irq, TSC2005State),
VMSTATE_BOOL(command, TSC2005State), VMSTATE_BOOL(command, TSC2005State),

View File

@ -1017,7 +1017,7 @@ static int tsc210x_post_load(void *opaque, int version_id)
return 0; return 0;
} }
static VMStateField vmstatefields_tsc210x[] = { static const VMStateField vmstatefields_tsc210x[] = {
VMSTATE_BOOL(enabled, TSC210xState), VMSTATE_BOOL(enabled, TSC210xState),
VMSTATE_BOOL(host_mode, TSC210xState), VMSTATE_BOOL(host_mode, TSC210xState),
VMSTATE_BOOL(irq, TSC210xState), VMSTATE_BOOL(irq, TSC210xState),

View File

@ -293,7 +293,7 @@ static const VMStateDescription vmstate_virtio_input = {
.name = "virtio-input", .name = "virtio-input",
.minimum_version_id = VIRTIO_INPUT_VM_VERSION, .minimum_version_id = VIRTIO_INPUT_VM_VERSION,
.version_id = VIRTIO_INPUT_VM_VERSION, .version_id = VIRTIO_INPUT_VM_VERSION,
.fields = (VMStateField[]) { .fields = (const VMStateField[]) {
VMSTATE_VIRTIO_DEVICE, VMSTATE_VIRTIO_DEVICE,
VMSTATE_END_OF_LIST() VMSTATE_END_OF_LIST()
}, },