hw/usb: Constify VMState

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231221031652.119827-59-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2023-12-21 14:16:39 +11:00
parent 5e6aceb2dd
commit 3abedf29b4
25 changed files with 49 additions and 49 deletions

View File

@ -69,7 +69,7 @@ const VMStateDescription vmstate_usb_device = {
.version_id = 1,
.minimum_version_id = 1,
.post_load = usb_device_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT8(addr, USBDevice),
VMSTATE_INT32(state, USBDevice),
VMSTATE_INT32(remote_wakeup, USBDevice),

View File

@ -378,7 +378,7 @@ static const VMStateDescription passthru_vmstate = {
.name = "ccid-card-passthru",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_BUFFER(vscard_in_data, PassthruState),
VMSTATE_UINT32(vscard_in_pos, PassthruState),
VMSTATE_UINT32(vscard_in_hdr, PassthruState),

View File

@ -756,7 +756,7 @@ static const VMStateDescription vmstate_usb_ptr = {
.version_id = 1,
.minimum_version_id = 1,
.post_load = usb_ptr_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, USBHIDState),
VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),
VMSTATE_END_OF_LIST()
@ -767,7 +767,7 @@ static const VMStateDescription vmstate_usb_kbd = {
.name = "usb-kbd",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, USBHIDState),
VMSTATE_HID_KEYBOARD_DEVICE(hid, USBHIDState),
VMSTATE_END_OF_LIST()

View File

@ -623,7 +623,7 @@ static const VMStateDescription vmstate_usb_hub_port = {
.name = "usb-hub-port",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT16(wPortStatus, USBHubPort),
VMSTATE_UINT16(wPortChange, USBHubPort),
VMSTATE_END_OF_LIST()
@ -642,7 +642,7 @@ static const VMStateDescription vmstate_usb_hub_port_timer = {
.version_id = 1,
.minimum_version_id = 1,
.needed = usb_hub_port_timer_needed,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_TIMER_PTR(port_timer, USBHubState),
VMSTATE_END_OF_LIST()
},
@ -652,13 +652,13 @@ static const VMStateDescription vmstate_usb_hub = {
.name = "usb-hub",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, USBHubState),
VMSTATE_STRUCT_ARRAY(ports, USBHubState, MAX_PORTS, 0,
vmstate_usb_hub_port, USBHubPort),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription * []) {
.subsections = (const VMStateDescription * const []) {
&vmstate_usb_hub_port_timer,
NULL
}

View File

@ -2072,7 +2072,7 @@ static const VMStateDescription vmstate_usb_mtp = {
.unmigratable = 1,
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, MTPState),
VMSTATE_END_OF_LIST()
}

View File

@ -1367,7 +1367,7 @@ static const VMStateDescription bulk_in_vmstate = {
.name = "CCID BulkIn state",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_BUFFER(data, BulkIn),
VMSTATE_UINT32(len, BulkIn),
VMSTATE_UINT32(pos, BulkIn),
@ -1379,7 +1379,7 @@ static const VMStateDescription answer_vmstate = {
.name = "CCID Answer state",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT8(slot, Answer),
VMSTATE_UINT8(seq, Answer),
VMSTATE_END_OF_LIST()
@ -1390,7 +1390,7 @@ static const VMStateDescription usb_device_vmstate = {
.name = "usb_device",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT8(addr, USBDevice),
VMSTATE_BUFFER(setup_buf, USBDevice),
VMSTATE_BUFFER(data_buf, USBDevice),
@ -1404,7 +1404,7 @@ static const VMStateDescription ccid_vmstate = {
.minimum_version_id = 1,
.post_load = ccid_post_load,
.pre_save = ccid_pre_save,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_STRUCT(dev, USBCCIDState, 1, usb_device_vmstate, USBDevice),
VMSTATE_UINT8(debug, USBCCIDState),
VMSTATE_BUFFER(bulk_out_data, USBCCIDState),

View File

@ -572,7 +572,7 @@ static const VMStateDescription vmstate_usb_msd = {
.name = "usb-storage",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, MSDState),
VMSTATE_UINT32(mode, MSDState),
VMSTATE_UINT32(scsi_len, MSDState),

View File

@ -947,7 +947,7 @@ static void usb_uas_realize(USBDevice *dev, Error **errp)
static const VMStateDescription vmstate_usb_uas = {
.name = "usb-uas",
.unmigratable = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, UASDevice),
VMSTATE_END_OF_LIST()
}

View File

@ -1391,7 +1391,7 @@ static const VMStateDescription vmstate_dwc2_state_packet = {
.name = "dwc2/packet",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32(devadr, DWC2Packet),
VMSTATE_UINT32(epnum, DWC2Packet),
VMSTATE_UINT32(epdir, DWC2Packet),
@ -1411,7 +1411,7 @@ const VMStateDescription vmstate_dwc2_state = {
.name = "dwc2",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(glbreg, DWC2State,
DWC2_GLBREG_SIZE / sizeof(uint32_t)),
VMSTATE_UINT32_ARRAY(fszreg, DWC2State,

View File

@ -648,7 +648,7 @@ static void usb_dwc3_init(Object *obj)
static const VMStateDescription vmstate_usb_dwc3 = {
.name = "usb-dwc3",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(regs, USBDWC3, USB_DWC3_R_MAX),
VMSTATE_UINT8(cfg.mode, USBDWC3),
VMSTATE_UINT32(cfg.dwc_usb3_user, USBDWC3),

View File

@ -144,7 +144,7 @@ static const VMStateDescription vmstate_ehci_pci = {
.name = "ehci",
.version_id = 2,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(pcidev, EHCIPCIState),
VMSTATE_STRUCT(ehci, EHCIPCIState, 2, vmstate_ehci, EHCIState),
VMSTATE_END_OF_LIST()

View File

@ -25,7 +25,7 @@ static const VMStateDescription vmstate_ehci_sysbus = {
.name = "ehci-sysbus",
.version_id = 2,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_STRUCT(ehci, EHCISysBusState, 2, vmstate_ehci, EHCIState),
VMSTATE_END_OF_LIST()
}

View File

@ -2473,7 +2473,7 @@ const VMStateDescription vmstate_ehci = {
.minimum_version_id = 1,
.pre_save = usb_ehci_pre_save,
.post_load = usb_ehci_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
/* mmio registers */
VMSTATE_UINT32(usbcmd, EHCIState),
VMSTATE_UINT32(usbsts, EHCIState),

View File

@ -120,7 +120,7 @@ static const VMStateDescription vmstate_ohci = {
.name = "ohci",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(parent_obj, OHCIPCIState),
VMSTATE_STRUCT(state, OHCIPCIState, 1, vmstate_ohci_state, OHCIState),
VMSTATE_END_OF_LIST()

View File

@ -1984,7 +1984,7 @@ static const VMStateDescription vmstate_ohci_state_port = {
.name = "ohci-core/port",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32(ctrl, OHCIPort),
VMSTATE_END_OF_LIST()
},
@ -2002,7 +2002,7 @@ static const VMStateDescription vmstate_ohci_eof_timer = {
.version_id = 1,
.minimum_version_id = 1,
.needed = ohci_eof_timer_needed,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_TIMER_PTR(eof_timer, OHCIState),
VMSTATE_END_OF_LIST()
},
@ -2012,7 +2012,7 @@ const VMStateDescription vmstate_ohci_state = {
.name = "ohci-core",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_INT64(sof_time, OHCIState),
VMSTATE_UINT32(ctl, OHCIState),
VMSTATE_UINT32(status, OHCIState),
@ -2049,7 +2049,7 @@ const VMStateDescription vmstate_ohci_state = {
VMSTATE_BOOL(async_complete, OHCIState),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription*[]) {
.subsections = (const VMStateDescription * const []) {
&vmstate_ohci_eof_timer,
NULL
}

View File

@ -339,7 +339,7 @@ static const VMStateDescription vmstate_uhci_port = {
.name = "uhci port",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT16(ctrl, UHCIPort),
VMSTATE_END_OF_LIST()
}
@ -361,7 +361,7 @@ static const VMStateDescription vmstate_uhci = {
.version_id = 3,
.minimum_version_id = 1,
.post_load = uhci_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, UHCIState),
VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState, NULL),
VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,

View File

@ -178,7 +178,7 @@ static const VMStateDescription vmstate_xhci_pci = {
.name = "xhci",
.version_id = 1,
.post_load = xhci_pci_vmstate_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(parent_obj, XHCIPciState),
VMSTATE_MSIX(parent_obj, XHCIPciState),
VMSTATE_STRUCT(xhci, XHCIPciState, 1, vmstate_xhci, XHCIState),

View File

@ -91,7 +91,7 @@ static Property xhci_sysbus_props[] = {
static const VMStateDescription vmstate_xhci_sysbus = {
.name = "xhci-sysbus",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_STRUCT(xhci, XHCISysbusState, 1, vmstate_xhci, XHCIState),
VMSTATE_END_OF_LIST()
}

View File

@ -3522,7 +3522,7 @@ static int usb_xhci_post_load(void *opaque, int version_id)
static const VMStateDescription vmstate_xhci_ring = {
.name = "xhci-ring",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT64(dequeue, XHCIRing),
VMSTATE_BOOL(ccs, XHCIRing),
VMSTATE_END_OF_LIST()
@ -3532,7 +3532,7 @@ static const VMStateDescription vmstate_xhci_ring = {
static const VMStateDescription vmstate_xhci_port = {
.name = "xhci-port",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32(portsc, XHCIPort),
VMSTATE_END_OF_LIST()
}
@ -3541,7 +3541,7 @@ static const VMStateDescription vmstate_xhci_port = {
static const VMStateDescription vmstate_xhci_slot = {
.name = "xhci-slot",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_BOOL(enabled, XHCISlot),
VMSTATE_BOOL(addressed, XHCISlot),
VMSTATE_END_OF_LIST()
@ -3551,7 +3551,7 @@ static const VMStateDescription vmstate_xhci_slot = {
static const VMStateDescription vmstate_xhci_event = {
.name = "xhci-event",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32(type, XHCIEvent),
VMSTATE_UINT32(ccode, XHCIEvent),
VMSTATE_UINT64(ptr, XHCIEvent),
@ -3571,7 +3571,7 @@ static bool xhci_er_full(void *opaque, int version_id)
static const VMStateDescription vmstate_xhci_intr = {
.name = "xhci-intr",
.version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
/* registers */
VMSTATE_UINT32(iman, XHCIInterrupter),
VMSTATE_UINT32(imod, XHCIInterrupter),
@ -3604,7 +3604,7 @@ const VMStateDescription vmstate_xhci = {
.name = "xhci-core",
.version_id = 1,
.post_load = usb_xhci_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1,
vmstate_xhci_port, XHCIPort),
VMSTATE_STRUCT_VARRAY_UINT32(slots, XHCIState, numslots, 1,

View File

@ -1753,7 +1753,7 @@ static const VMStateDescription vmstate_usb_host = {
.version_id = 1,
.minimum_version_id = 1,
.post_load = usb_host_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(parent_obj, USBHostDevice),
VMSTATE_END_OF_LIST()
}

View File

@ -20,7 +20,7 @@ static const VMStateDescription vmstate_imx_usbphy = {
.name = TYPE_IMX_USBPHY,
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(usbphy, IMXUSBPHYState, USBPHY_MAX),
VMSTATE_END_OF_LIST()
},

View File

@ -2373,7 +2373,7 @@ static const VMStateDescription usbredir_bulk_receiving_vmstate = {
.version_id = 1,
.minimum_version_id = 1,
.needed = usbredir_bulk_receiving_needed,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT8(bulk_receiving_started, struct endp_data),
VMSTATE_END_OF_LIST()
}
@ -2391,7 +2391,7 @@ static const VMStateDescription usbredir_stream_vmstate = {
.version_id = 1,
.minimum_version_id = 1,
.needed = usbredir_stream_needed,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32(max_streams, struct endp_data),
VMSTATE_END_OF_LIST()
}
@ -2401,7 +2401,7 @@ static const VMStateDescription usbredir_ep_vmstate = {
.name = "usb-redir-ep",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT8(type, struct endp_data),
VMSTATE_UINT8(interval, struct endp_data),
VMSTATE_UINT8(interface, struct endp_data),
@ -2424,7 +2424,7 @@ static const VMStateDescription usbredir_ep_vmstate = {
VMSTATE_INT32(bufpq_target_size, struct endp_data),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription*[]) {
.subsections = (const VMStateDescription * const []) {
&usbredir_bulk_receiving_vmstate,
&usbredir_stream_vmstate,
NULL
@ -2481,7 +2481,7 @@ static const VMStateDescription usbredir_ep_packet_id_queue_vmstate = {
.name = "usb-redir-packet-id-queue",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
{
.name = "queue",
.version_id = 0,
@ -2501,7 +2501,7 @@ static const VMStateDescription usbredir_device_info_vmstate = {
.name = "usb-redir-device-info",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT8(speed, struct usb_redir_device_connect_header),
VMSTATE_UINT8(device_class, struct usb_redir_device_connect_header),
VMSTATE_UINT8(device_subclass, struct usb_redir_device_connect_header),
@ -2520,7 +2520,7 @@ static const VMStateDescription usbredir_interface_info_vmstate = {
.name = "usb-redir-interface-info",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32(interface_count,
struct usb_redir_interface_info_header),
VMSTATE_UINT8_ARRAY(interface,
@ -2543,7 +2543,7 @@ static const VMStateDescription usbredir_vmstate = {
.minimum_version_id = 1,
.pre_save = usbredir_pre_save,
.post_load = usbredir_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, USBRedirDevice),
VMSTATE_TIMER_PTR(attach_timer, USBRedirDevice),
{

View File

@ -512,7 +512,7 @@ static const VMStateDescription u2f_passthru_vmstate = {
.version_id = 1,
.minimum_version_id = 1,
.post_load = u2f_passthru_post_load,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_U2F_KEY(base, U2FPassthruState),
VMSTATE_END_OF_LIST()
}

View File

@ -305,7 +305,7 @@ const VMStateDescription vmstate_u2f_key = {
.name = "u2f-key",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_USB_DEVICE(dev, U2FKeyState),
VMSTATE_UINT8(idle, U2FKeyState),
VMSTATE_UINT8_2DARRAY(pending_in, U2FKeyState,

View File

@ -196,7 +196,7 @@ static const VMStateDescription vmstate_usb2_ctrl_regs = {
.name = TYPE_XILINX_VERSAL_USB2_CTRL_REGS,
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(regs, VersalUsb2CtrlRegs, USB2_REGS_R_MAX),
VMSTATE_END_OF_LIST(),
}