hw/usb/hcd-ehci: Introduce common properties macro for sysbus and pci
EHCI properties are currently defined separately in both sysbus and PCI implementations, leading to duplicated code for common fields such as "maxframes". Introduce DEFINE_EHCI_COMMON_PROPERTIES() to consolidate shared property definitions and reuse them across both EHCISysBusState and EHCIPCIState. This reduces code duplication and keeps property definitions consistent between different EHCI device variants. No functional change. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260424080508.53992-8-jamin_lin@aspeedtech.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Jamin Lin committed
Apr 23, 2026 at 07:18 UTC
4a80a676571788eebc0965c1e74112986a742539
3 files changed
+5
-2
hw/usb/hcd-ehci-pci.c
+1
-1
@@ -136,7 +136,7 @@ static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr,
136
}
137
138
static const Property ehci_pci_properties[] = {
139
- DEFINE_PROP_UINT32("maxframes", EHCIPCIState, ehci.maxframes, 128),
139
+ DEFINE_EHCI_COMMON_PROPERTIES(EHCIPCIState),
140
};
141
142
static const VMStateDescription vmstate_ehci_pci = {
hw/usb/hcd-ehci-sysbus.c
+1
-1
@@ -31,7 +31,7 @@ static const VMStateDescription vmstate_ehci_sysbus = {
31
};
32
33
static const Property ehci_sysbus_properties[] = {
34
- DEFINE_PROP_UINT32("maxframes", EHCISysBusState, ehci.maxframes, 128),
34
+ DEFINE_EHCI_COMMON_PROPERTIES(EHCISysBusState),
35
DEFINE_PROP_BOOL("companion-enable", EHCISysBusState, ehci.companion_enable,
36
false),
37
};
hw/usb/hcd-ehci.h
+3
@@ -307,6 +307,9 @@ struct EHCIState {
307
VMChangeStateEntry *vmstate;
308
};
309
310
+#define DEFINE_EHCI_COMMON_PROPERTIES(_state) \
311
+ DEFINE_PROP_UINT32("maxframes", _state, ehci.maxframes, 128)
312
+
313
extern const VMStateDescription vmstate_ehci;
314
315
void usb_ehci_init(EHCIState *s, DeviceState *dev);