[PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC

Eduardo Habkost posted 63 patches 5 years, 5 months ago
[PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC
Posted by Eduardo Habkost 5 years, 5 months ago
This will make the type name constant consistent with the name of
the type checking macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hw/intc/i8259.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index 344fd04db1..e536cc90be 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -37,10 +37,10 @@
 
 //#define DEBUG_IRQ_LATENCY
 
-#define TYPE_I8259 "isa-i8259"
+#define TYPE_PIC "isa-i8259"
 typedef struct PICClass PICClass;
 DECLARE_CLASS_CHECKERS(PICClass, PIC,
-                       TYPE_I8259)
+                       TYPE_PIC)
 
 /**
  * PICClass:
@@ -418,7 +418,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
 
     irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
 
-    isadev = i8259_init_chip(TYPE_I8259, bus, true);
+    isadev = i8259_init_chip(TYPE_PIC, bus, true);
     dev = DEVICE(isadev);
 
     qdev_connect_gpio_out(dev, 0, parent_irq);
@@ -428,7 +428,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
 
     isa_pic = dev;
 
-    isadev = i8259_init_chip(TYPE_I8259, bus, false);
+    isadev = i8259_init_chip(TYPE_PIC, bus, false);
     dev = DEVICE(isadev);
 
     qdev_connect_gpio_out(dev, 0, irq_set[2]);
@@ -451,7 +451,7 @@ static void i8259_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo i8259_info = {
-    .name       = TYPE_I8259,
+    .name       = TYPE_PIC,
     .instance_size = sizeof(PICCommonState),
     .parent     = TYPE_PIC_COMMON,
     .class_init = i8259_class_init,
-- 
2.26.2


Re: [PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
On 9/3/20 12:42 AM, Eduardo Habkost wrote:
> This will make the type name constant consistent with the name of
> the type checking macro.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hw/intc/i8259.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
> index 344fd04db1..e536cc90be 100644
> --- a/hw/intc/i8259.c
> +++ b/hw/intc/i8259.c
> @@ -37,10 +37,10 @@
>  
>  //#define DEBUG_IRQ_LATENCY
>  
> -#define TYPE_I8259 "isa-i8259"
> +#define TYPE_PIC "isa-i8259"

I disagree with this patch, as we have various PIC and only one I8259.

>  typedef struct PICClass PICClass;
>  DECLARE_CLASS_CHECKERS(PICClass, PIC,
> -                       TYPE_I8259)
> +                       TYPE_PIC)
>  
>  /**
>   * PICClass:
> @@ -418,7 +418,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
>  
>      irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
>  
> -    isadev = i8259_init_chip(TYPE_I8259, bus, true);
> +    isadev = i8259_init_chip(TYPE_PIC, bus, true);
>      dev = DEVICE(isadev);
>  
>      qdev_connect_gpio_out(dev, 0, parent_irq);
> @@ -428,7 +428,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
>  
>      isa_pic = dev;
>  
> -    isadev = i8259_init_chip(TYPE_I8259, bus, false);
> +    isadev = i8259_init_chip(TYPE_PIC, bus, false);
>      dev = DEVICE(isadev);
>  
>      qdev_connect_gpio_out(dev, 0, irq_set[2]);
> @@ -451,7 +451,7 @@ static void i8259_class_init(ObjectClass *klass, void *data)
>  }
>  
>  static const TypeInfo i8259_info = {
> -    .name       = TYPE_I8259,
> +    .name       = TYPE_PIC,
>      .instance_size = sizeof(PICCommonState),
>      .parent     = TYPE_PIC_COMMON,
>      .class_init = i8259_class_init,
> 


Re: [PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC
Posted by Eduardo Habkost 5 years, 5 months ago
On Thu, Sep 03, 2020 at 02:47:33PM +0200, Philippe Mathieu-Daudé wrote:
> On 9/3/20 12:42 AM, Eduardo Habkost wrote:
> > This will make the type name constant consistent with the name of
> > the type checking macro.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > Cc: "Michael S. Tsirkin" <mst@redhat.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: qemu-devel@nongnu.org
> > ---
> >  hw/intc/i8259.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
> > index 344fd04db1..e536cc90be 100644
> > --- a/hw/intc/i8259.c
> > +++ b/hw/intc/i8259.c
> > @@ -37,10 +37,10 @@
> >  
> >  //#define DEBUG_IRQ_LATENCY
> >  
> > -#define TYPE_I8259 "isa-i8259"
> > +#define TYPE_PIC "isa-i8259"
> 
> I disagree with this patch, as we have various PIC and only one I8259.

Like in the I8254 case, I agree with your point.  I will suggest
renaming the PIC macro to I8259 instead.

-- 
Eduardo


Re: [PATCH 15/63] i8259: Rename TYPE_I8259 to TYPE_PIC
Posted by Daniel P. Berrangé 5 years, 5 months ago
On Thu, Sep 03, 2020 at 12:19:46PM -0400, Eduardo Habkost wrote:
> On Thu, Sep 03, 2020 at 02:47:33PM +0200, Philippe Mathieu-Daudé wrote:
> > On 9/3/20 12:42 AM, Eduardo Habkost wrote:
> > > This will make the type name constant consistent with the name of
> > > the type checking macro.
> > > 
> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > > ---
> > > Cc: "Michael S. Tsirkin" <mst@redhat.com>
> > > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > > Cc: qemu-devel@nongnu.org
> > > ---
> > >  hw/intc/i8259.c | 10 +++++-----
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
> > > index 344fd04db1..e536cc90be 100644
> > > --- a/hw/intc/i8259.c
> > > +++ b/hw/intc/i8259.c
> > > @@ -37,10 +37,10 @@
> > >  
> > >  //#define DEBUG_IRQ_LATENCY
> > >  
> > > -#define TYPE_I8259 "isa-i8259"
> > > +#define TYPE_PIC "isa-i8259"
> > 
> > I disagree with this patch, as we have various PIC and only one I8259.
> 
> Like in the I8254 case, I agree with your point.  I will suggest
> renaming the PIC macro to I8259 instead.

I'd suggest it should be TYPE_ISA_I8259  to match the object type name
string.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|