hw/usb: Constify all Property

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-12-13 17:26:45 +00:00
parent 35d71fd9ce
commit 44f2f4bc30
27 changed files with 32 additions and 32 deletions

View File

@ -18,7 +18,7 @@ static char *usb_get_dev_path(DeviceState *dev);
static char *usb_get_fw_dev_path(DeviceState *qdev); static char *usb_get_fw_dev_path(DeviceState *qdev);
static void usb_qdev_unrealize(DeviceState *qdev); static void usb_qdev_unrealize(DeviceState *qdev);
static Property usb_props[] = { static const Property usb_props[] = {
DEFINE_PROP_STRING("port", USBDevice, port_path), DEFINE_PROP_STRING("port", USBDevice, port_path),
DEFINE_PROP_STRING("serial", USBDevice, serial), DEFINE_PROP_STRING("serial", USBDevice, serial),
DEFINE_PROP_BIT("msos-desc", USBDevice, flags, DEFINE_PROP_BIT("msos-desc", USBDevice, flags,

View File

@ -296,7 +296,7 @@ static void canokey_unrealize(USBDevice *base)
trace_canokey_unrealize(); trace_canokey_unrealize();
} }
static Property canokey_properties[] = { static const Property canokey_properties[] = {
DEFINE_PROP_STRING("file", CanoKeyState, file), DEFINE_PROP_STRING("file", CanoKeyState, file),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -582,7 +582,7 @@ static void emulated_unrealize(CCIDCardState *base)
qemu_mutex_destroy(&card->event_list_mutex); qemu_mutex_destroy(&card->event_list_mutex);
} }
static Property emulated_card_properties[] = { static const Property emulated_card_properties[] = {
DEFINE_PROP_STRING("backend", EmulatedState, backend_str), DEFINE_PROP_STRING("backend", EmulatedState, backend_str),
DEFINE_PROP_STRING("cert1", EmulatedState, cert1), DEFINE_PROP_STRING("cert1", EmulatedState, cert1),
DEFINE_PROP_STRING("cert2", EmulatedState, cert2), DEFINE_PROP_STRING("cert2", EmulatedState, cert2),

View File

@ -388,7 +388,7 @@ static const VMStateDescription passthru_vmstate = {
} }
}; };
static Property passthru_card_properties[] = { static const Property passthru_card_properties[] = {
DEFINE_PROP_CHR("chardev", PassthruState, cs), DEFINE_PROP_CHR("chardev", PassthruState, cs),
DEFINE_PROP_UINT8("debug", PassthruState, debug, 0), DEFINE_PROP_UINT8("debug", PassthruState, debug, 0),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),

View File

@ -990,7 +990,7 @@ static const VMStateDescription vmstate_usb_audio = {
.unmigratable = 1, .unmigratable = 1,
}; };
static Property usb_audio_properties[] = { static const Property usb_audio_properties[] = {
DEFINE_AUDIO_PROPERTIES(USBAudioState, card), DEFINE_AUDIO_PROPERTIES(USBAudioState, card),
DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0), DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0),
DEFINE_PROP_UINT32("buffer", USBAudioState, buffer_user, 0), DEFINE_PROP_UINT32("buffer", USBAudioState, buffer_user, 0),

View File

@ -793,7 +793,7 @@ static const TypeInfo usb_hid_type_info = {
.class_init = usb_hid_class_initfn, .class_init = usb_hid_class_initfn,
}; };
static Property usb_tablet_properties[] = { static const Property usb_tablet_properties[] = {
DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2),
DEFINE_PROP_STRING("display", USBHIDState, display), DEFINE_PROP_STRING("display", USBHIDState, display),
DEFINE_PROP_UINT32("head", USBHIDState, head, 0), DEFINE_PROP_UINT32("head", USBHIDState, head, 0),
@ -818,7 +818,7 @@ static const TypeInfo usb_tablet_info = {
.class_init = usb_tablet_class_initfn, .class_init = usb_tablet_class_initfn,
}; };
static Property usb_mouse_properties[] = { static const Property usb_mouse_properties[] = {
DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
@ -841,7 +841,7 @@ static const TypeInfo usb_mouse_info = {
.class_init = usb_mouse_class_initfn, .class_init = usb_mouse_class_initfn,
}; };
static Property usb_keyboard_properties[] = { static const Property usb_keyboard_properties[] = {
DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2),
DEFINE_PROP_STRING("display", USBHIDState, display), DEFINE_PROP_STRING("display", USBHIDState, display),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),

View File

@ -665,7 +665,7 @@ static const VMStateDescription vmstate_usb_hub = {
} }
}; };
static Property usb_hub_properties[] = { static const Property usb_hub_properties[] = {
DEFINE_PROP_UINT32("ports", USBHubState, num_ports, 8), DEFINE_PROP_UINT32("ports", USBHubState, num_ports, 8),
DEFINE_PROP_BOOL("port-power", USBHubState, port_power, false), DEFINE_PROP_BOOL("port-power", USBHubState, port_power, false),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),

View File

@ -2078,7 +2078,7 @@ static const VMStateDescription vmstate_usb_mtp = {
} }
}; };
static Property mtp_properties[] = { static const Property mtp_properties[] = {
DEFINE_PROP_STRING("rootdir", MTPState, root), DEFINE_PROP_STRING("rootdir", MTPState, root),
DEFINE_PROP_STRING("desc", MTPState, desc), DEFINE_PROP_STRING("desc", MTPState, desc),
DEFINE_PROP_BOOL("readonly", MTPState, readonly, true), DEFINE_PROP_BOOL("readonly", MTPState, readonly, true),

View File

@ -1407,7 +1407,7 @@ static const VMStateDescription vmstate_usb_net = {
.unmigratable = 1, .unmigratable = 1,
}; };
static Property net_properties[] = { static const Property net_properties[] = {
DEFINE_NIC_PROPERTIES(USBNetState, conf), DEFINE_NIC_PROPERTIES(USBNetState, conf),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -634,7 +634,7 @@ static const VMStateDescription vmstate_usb_serial = {
.unmigratable = 1, .unmigratable = 1,
}; };
static Property serial_properties[] = { static const Property serial_properties[] = {
DEFINE_PROP_CHR("chardev", USBSerialState, cs), DEFINE_PROP_CHR("chardev", USBSerialState, cs),
DEFINE_PROP_BOOL("always-plugged", USBSerialState, always_plugged, false), DEFINE_PROP_BOOL("always-plugged", USBSerialState, always_plugged, false),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
@ -677,7 +677,7 @@ static const TypeInfo serial_info = {
.class_init = usb_serial_class_initfn, .class_init = usb_serial_class_initfn,
}; };
static Property braille_properties[] = { static const Property braille_properties[] = {
DEFINE_PROP_CHR("chardev", USBSerialState, cs), DEFINE_PROP_CHR("chardev", USBSerialState, cs),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -1171,7 +1171,7 @@ static Answer *ccid_peek_next_answer(USBCCIDState *s)
: &s->pending_answers[s->pending_answers_start % PENDING_ANSWERS_NUM]; : &s->pending_answers[s->pending_answers_start % PENDING_ANSWERS_NUM];
} }
static Property ccid_props[] = { static const Property ccid_props[] = {
DEFINE_PROP_UINT32("slot", struct CCIDCardState, slot, 0), DEFINE_PROP_UINT32("slot", struct CCIDCardState, slot, 0),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
@ -1431,7 +1431,7 @@ static const VMStateDescription ccid_vmstate = {
} }
}; };
static Property ccid_properties[] = { static const Property ccid_properties[] = {
DEFINE_PROP_UINT8("debug", USBCCIDState, debug, 0), DEFINE_PROP_UINT8("debug", USBCCIDState, debug, 0),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -67,7 +67,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
s->scsi_dev = scsi_dev; s->scsi_dev = scsi_dev;
} }
static Property msd_properties[] = { static const Property msd_properties[] = {
DEFINE_BLOCK_PROPERTIES(MSDState, conf), DEFINE_BLOCK_PROPERTIES(MSDState, conf),
DEFINE_BLOCK_ERROR_PROPERTIES(MSDState, conf), DEFINE_BLOCK_ERROR_PROPERTIES(MSDState, conf),
DEFINE_PROP_BOOL("removable", MSDState, removable, false), DEFINE_PROP_BOOL("removable", MSDState, removable, false),

View File

@ -953,7 +953,7 @@ static const VMStateDescription vmstate_usb_uas = {
} }
}; };
static Property uas_properties[] = { static const Property uas_properties[] = {
DEFINE_PROP_UINT32("log-scsi-req", UASDevice, requestlog, 0), DEFINE_PROP_UINT32("log-scsi-req", UASDevice, requestlog, 0),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -1448,7 +1448,7 @@ const VMStateDescription vmstate_dwc2_state = {
} }
}; };
static Property dwc2_usb_properties[] = { static const Property dwc2_usb_properties[] = {
DEFINE_PROP_UINT32("usb_version", DWC2State, usb_version, 2), DEFINE_PROP_UINT32("usb_version", DWC2State, usb_version, 2),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -656,7 +656,7 @@ static const VMStateDescription vmstate_usb_dwc3 = {
} }
}; };
static Property usb_dwc3_properties[] = { static const Property usb_dwc3_properties[] = {
DEFINE_PROP_UINT32("DWC_USB3_USERID", USBDWC3, cfg.dwc_usb3_user, DEFINE_PROP_UINT32("DWC_USB3_USERID", USBDWC3, cfg.dwc_usb3_user,
0x12345678), 0x12345678),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),

View File

@ -135,7 +135,7 @@ static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr,
i->ehci.as = busmaster ? pci_get_address_space(dev) : &address_space_memory; i->ehci.as = busmaster ? pci_get_address_space(dev) : &address_space_memory;
} }
static Property ehci_pci_properties[] = { static const Property ehci_pci_properties[] = {
DEFINE_PROP_UINT32("maxframes", EHCIPCIState, ehci.maxframes, 128), DEFINE_PROP_UINT32("maxframes", EHCIPCIState, ehci.maxframes, 128),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -30,7 +30,7 @@ static const VMStateDescription vmstate_ehci_sysbus = {
} }
}; };
static Property ehci_sysbus_properties[] = { static const Property ehci_sysbus_properties[] = {
DEFINE_PROP_UINT32("maxframes", EHCISysBusState, ehci.maxframes, 128), DEFINE_PROP_UINT32("maxframes", EHCISysBusState, ehci.maxframes, 128),
DEFINE_PROP_BOOL("companion-enable", EHCISysBusState, ehci.companion_enable, DEFINE_PROP_BOOL("companion-enable", EHCISysBusState, ehci.companion_enable,
false), false),

View File

@ -109,7 +109,7 @@ static void usb_ohci_reset_pci(DeviceState *d)
ohci_hard_reset(s); ohci_hard_reset(s);
} }
static Property ohci_pci_properties[] = { static const Property ohci_pci_properties[] = {
DEFINE_PROP_STRING("masterbus", OHCIPCIState, masterbus), DEFINE_PROP_STRING("masterbus", OHCIPCIState, masterbus),
DEFINE_PROP_UINT32("num-ports", OHCIPCIState, num_ports, 3), DEFINE_PROP_UINT32("num-ports", OHCIPCIState, num_ports, 3),
DEFINE_PROP_UINT32("firstport", OHCIPCIState, firstport, 0), DEFINE_PROP_UINT32("firstport", OHCIPCIState, firstport, 0),

View File

@ -57,7 +57,7 @@ static void ohci_sysbus_reset(DeviceState *dev)
ohci_hard_reset(ohci); ohci_hard_reset(ohci);
} }
static Property ohci_sysbus_properties[] = { static const Property ohci_sysbus_properties[] = {
DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus), DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus),
DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3), DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0), DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0),

View File

@ -1227,14 +1227,14 @@ static void usb_uhci_exit(PCIDevice *dev)
} }
} }
static Property uhci_properties_companion[] = { static const Property uhci_properties_companion[] = {
DEFINE_PROP_STRING("masterbus", UHCIState, masterbus), DEFINE_PROP_STRING("masterbus", UHCIState, masterbus),
DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0), DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0),
DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280), DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280),
DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128), DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
static Property uhci_properties_standalone[] = { static const Property uhci_properties_standalone[] = {
DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280), DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280),
DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128), DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),

View File

@ -36,7 +36,7 @@ struct XHCINecState {
uint32_t slots; uint32_t slots;
}; };
static Property nec_xhci_properties[] = { static const Property nec_xhci_properties[] = {
DEFINE_PROP_ON_OFF_AUTO("msi", XHCIPciState, msi, ON_OFF_AUTO_AUTO), DEFINE_PROP_ON_OFF_AUTO("msi", XHCIPciState, msi, ON_OFF_AUTO_AUTO),
DEFINE_PROP_ON_OFF_AUTO("msix", XHCIPciState, msix, ON_OFF_AUTO_AUTO), DEFINE_PROP_ON_OFF_AUTO("msix", XHCIPciState, msix, ON_OFF_AUTO_AUTO),
DEFINE_PROP_UINT32("intrs", XHCINecState, intrs, XHCI_MAXINTRS), DEFINE_PROP_UINT32("intrs", XHCINecState, intrs, XHCI_MAXINTRS),

View File

@ -82,7 +82,7 @@ void xhci_sysbus_build_aml(Aml *scope, uint32_t mmio, unsigned int irq)
aml_append(scope, dev); aml_append(scope, dev);
} }
static Property xhci_sysbus_props[] = { static const Property xhci_sysbus_props[] = {
DEFINE_PROP_UINT32("intrs", XHCISysbusState, xhci.numintrs, XHCI_MAXINTRS), DEFINE_PROP_UINT32("intrs", XHCISysbusState, xhci.numintrs, XHCI_MAXINTRS),
DEFINE_PROP_UINT32("slots", XHCISysbusState, xhci.numslots, XHCI_MAXSLOTS), DEFINE_PROP_UINT32("slots", XHCISysbusState, xhci.numslots, XHCI_MAXSLOTS),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),

View File

@ -3605,7 +3605,7 @@ const VMStateDescription vmstate_xhci = {
} }
}; };
static Property xhci_properties[] = { static const Property xhci_properties[] = {
DEFINE_PROP_BIT("streams", XHCIState, flags, DEFINE_PROP_BIT("streams", XHCIState, flags,
XHCI_FLAG_ENABLE_STREAMS, true), XHCI_FLAG_ENABLE_STREAMS, true),
DEFINE_PROP_UINT32("p2", XHCIState, numports_2, 4), DEFINE_PROP_UINT32("p2", XHCIState, numports_2, 4),

View File

@ -1758,7 +1758,7 @@ static const VMStateDescription vmstate_usb_host = {
} }
}; };
static Property usb_host_dev_properties[] = { static const Property usb_host_dev_properties[] = {
DEFINE_PROP_UINT32("hostbus", USBHostDevice, match.bus_num, 0), DEFINE_PROP_UINT32("hostbus", USBHostDevice, match.bus_num, 0),
DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr, 0), DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr, 0),
DEFINE_PROP_STRING("hostport", USBHostDevice, match.port), DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),

View File

@ -2573,7 +2573,7 @@ static const VMStateDescription usbredir_vmstate = {
} }
}; };
static Property usbredir_properties[] = { static const Property usbredir_properties[] = {
DEFINE_PROP_CHR("chardev", USBRedirDevice, cs), DEFINE_PROP_CHR("chardev", USBRedirDevice, cs),
DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, usbredirparser_warning), DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, usbredirparser_warning),
DEFINE_PROP_STRING("filter", USBRedirDevice, filter_str), DEFINE_PROP_STRING("filter", USBRedirDevice, filter_str),

View File

@ -369,7 +369,7 @@ static void u2f_emulated_unrealize(U2FKeyState *base)
} }
} }
static Property u2f_emulated_properties[] = { static const Property u2f_emulated_properties[] = {
DEFINE_PROP_STRING("dir", U2FEmulatedState, dir), DEFINE_PROP_STRING("dir", U2FEmulatedState, dir),
DEFINE_PROP_STRING("cert", U2FEmulatedState, cert), DEFINE_PROP_STRING("cert", U2FEmulatedState, cert),
DEFINE_PROP_STRING("privkey", U2FEmulatedState, privkey), DEFINE_PROP_STRING("privkey", U2FEmulatedState, privkey),

View File

@ -516,7 +516,7 @@ static const VMStateDescription u2f_passthru_vmstate = {
} }
}; };
static Property u2f_passthru_properties[] = { static const Property u2f_passthru_properties[] = {
DEFINE_PROP_STRING("hidraw", U2FPassthruState, hidraw), DEFINE_PROP_STRING("hidraw", U2FPassthruState, hidraw),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };