@@ -2488,18 +2488,6 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
.abstract = true,
.interfaces = t->interfaces,
};
- const TypeInfo generic_type_info = {
- .name = t->generic_name,
- .parent = t->base_name ?: base_name,
- .class_init = t->base_name ? virtio_pci_generic_class_init
- : virtio_pci_base_class_init,
- .class_data = t->base_name ? NULL : t,
- .interfaces = (const InterfaceInfo[]) {
- { INTERFACE_PCIE_DEVICE },
- { INTERFACE_CONVENTIONAL_PCI_DEVICE },
- { }
- },
- };
assert(t->base_name || !t->non_transitional_name);
assert(t->base_name || !t->transitional_name);
@@ -2507,6 +2495,19 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
type_register_static(&base_type_info);
if (t->generic_name) {
+ const TypeInfo generic_type_info = {
+ .name = t->generic_name,
+ .parent = t->base_name ?: base_name,
+ .class_init = t->base_name ? virtio_pci_generic_class_init
+ : virtio_pci_base_class_init,
+ .class_data = t->base_name ? NULL : t,
+ .interfaces = (const InterfaceInfo[]) {
+ { INTERFACE_PCIE_DEVICE },
+ { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+ { }
+ },
+ };
+
type_register_static(&generic_type_info);
}
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/virtio/virtio-pci.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)