hw/i386/pc: Simplify ioapic_init_gsi()
PATCH 1/1 hw/i386/pc: Simplify ioapic_init_gsi()
All callers of ioapic_init_gsi() provide a parent. We want new uses to follow the same good practice and provide the parent name, so do not make this optional: assert the parent name is provided, and simplify the code.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- hw/i386/pc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/i386/pc.c +3 -4
@@ -1488,15 +1488,14 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)SysBusDevice *d;unsigned int i; +assert (parent_name);if (kvm_ioapic_in_kernel ()) { dev =qdev_create (NULL ,TYPE_KVM_IOAPIC ); }else { dev =qdev_create (NULL ,TYPE_IOAPIC ); } -if (parent_name) { -object_property_add_child (object_resolve_path (parent_name,NULL ), -"ioapic" ,OBJECT (dev),NULL ); - } +object_property_add_child (object_resolve_path (parent_name,NULL ), +"ioapic" ,OBJECT (dev),NULL );qdev_init_nofail (dev); d =SYS_BUS_DEVICE (dev);sysbus_mmio_map (d,0 ,IO_APIC_DEFAULT_ADDRESS );
Signature · 1 line
2.21.0
Paolo Bonzini
AppliedQuoted 24 lines · Philippe Mathieu-Daudé
All callers of
ioapic_init_gsi()provide a parent. We want new uses to follow the same good practice and provide the parent name, so do not make this optional: assert the parent name is provided, and simplify the code.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/pc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/i386/pc.c +1
-0@@ -1488,15 +1488,14 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)SysBusDevice *d;unsigned int i; +assert (parent_name);if (kvm_ioapic_in_kernel ()) { dev =qdev_create (NULL ,TYPE_KVM_IOAPIC ); }else { dev =qdev_create (NULL ,TYPE_IOAPIC );
hw/i386/pc.c void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) · line 1501
Quoted 10 lines
hw/i386/pc.c +2
-4} -if (parent_name) { -object_property_add_child (object_resolve_path (parent_name,NULL ), -"ioapic" ,OBJECT (dev),NULL ); - } +object_property_add_child (object_resolve_path (parent_name,NULL ), +"ioapic" ,OBJECT (dev),NULL );qdev_init_nofail (dev); d =SYS_BUS_DEVICE (dev);sysbus_mmio_map (d,0 ,IO_APIC_DEFAULT_ADDRESS );
Queued, thanks.
Paolo