qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/i386/pc: Simplify ioapic_init_gsi()
@ 2019-12-13 11:11 Philippe Mathieu-Daudé
  2019-12-13 11:55 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-13 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Michael S. Tsirkin, qemu-trivial, Paolo Bonzini,
	Philippe Mathieu-Daudé, Richard Henderson

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é <philmd@redhat.com>
---
 hw/i386/pc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index ac08e63604..234945d328 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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);
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hw/i386/pc: Simplify ioapic_init_gsi()
  2019-12-13 11:11 [PATCH] hw/i386/pc: Simplify ioapic_init_gsi() Philippe Mathieu-Daudé
@ 2019-12-13 11:55 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-12-13 11:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin

On 13/12/19 12:11, Philippe Mathieu-Daudé wrote:
> 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é <philmd@redhat.com>
> ---
>  hw/i386/pc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index ac08e63604..234945d328 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -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);
> 

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-13 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-13 11:11 [PATCH] hw/i386/pc: Simplify ioapic_init_gsi() Philippe Mathieu-Daudé
2019-12-13 11:55 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).