diff mbox series

[2/4] hw/irq: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE()

Message ID 20230113200138.52869-3-philmd@linaro.org
State Superseded
Headers show
Series hw: QOM housekeeping around IOTHREAD / IRQ types | expand

Commit Message

Philippe Mathieu-Daudé Jan. 13, 2023, 8:01 p.m. UTC
QOM *DECLARE* macros expect a typedef as first argument,
not a structure. Replace 'struct IRQState' by 'IRQState'
to avoid when modifying the macros:

  ../hw/core/irq.c:29:1: error: declaration of anonymous struct must be a definition
  DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ,
  ^

Use OBJECT_DECLARE_SIMPLE_TYPE instead of DECLARE_INSTANCE_CHECKER.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/irq.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Alistair Francis Jan. 16, 2023, 2:46 a.m. UTC | #1
On Sat, Jan 14, 2023 at 6:03 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> QOM *DECLARE* macros expect a typedef as first argument,
> not a structure. Replace 'struct IRQState' by 'IRQState'
> to avoid when modifying the macros:
>
>   ../hw/core/irq.c:29:1: error: declaration of anonymous struct must be a definition
>   DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ,
>   ^
>
> Use OBJECT_DECLARE_SIMPLE_TYPE instead of DECLARE_INSTANCE_CHECKER.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/core/irq.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/hw/core/irq.c b/hw/core/irq.c
> index 3623f711fe..3f14e2dda7 100644
> --- a/hw/core/irq.c
> +++ b/hw/core/irq.c
> @@ -26,8 +26,7 @@
>  #include "hw/irq.h"
>  #include "qom/object.h"
>
> -DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ,
> -                         TYPE_IRQ)
> +OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ)
>
>  struct IRQState {
>      Object parent_obj;
> @@ -68,7 +67,7 @@ qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n)
>
>  qemu_irq qemu_allocate_irq(qemu_irq_handler handler, void *opaque, int n)
>  {
> -    struct IRQState *irq;
> +    IRQState *irq;
>
>      irq = IRQ(object_new(TYPE_IRQ));
>      irq->handler = handler;
> @@ -94,7 +93,7 @@ void qemu_free_irq(qemu_irq irq)
>
>  static void qemu_notirq(void *opaque, int line, int level)
>  {
> -    struct IRQState *irq = opaque;
> +    IRQState *irq = opaque;
>
>      irq->handler(irq->opaque, irq->n, !level);
>  }
> @@ -120,7 +119,7 @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
>  static const TypeInfo irq_type_info = {
>     .name = TYPE_IRQ,
>     .parent = TYPE_OBJECT,
> -   .instance_size = sizeof(struct IRQState),
> +   .instance_size = sizeof(IRQState),
>  };
>
>  static void irq_register_types(void)
> --
> 2.38.1
>
>
diff mbox series

Patch

diff --git a/hw/core/irq.c b/hw/core/irq.c
index 3623f711fe..3f14e2dda7 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -26,8 +26,7 @@ 
 #include "hw/irq.h"
 #include "qom/object.h"
 
-DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ,
-                         TYPE_IRQ)
+OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ)
 
 struct IRQState {
     Object parent_obj;
@@ -68,7 +67,7 @@  qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n)
 
 qemu_irq qemu_allocate_irq(qemu_irq_handler handler, void *opaque, int n)
 {
-    struct IRQState *irq;
+    IRQState *irq;
 
     irq = IRQ(object_new(TYPE_IRQ));
     irq->handler = handler;
@@ -94,7 +93,7 @@  void qemu_free_irq(qemu_irq irq)
 
 static void qemu_notirq(void *opaque, int line, int level)
 {
-    struct IRQState *irq = opaque;
+    IRQState *irq = opaque;
 
     irq->handler(irq->opaque, irq->n, !level);
 }
@@ -120,7 +119,7 @@  void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
 static const TypeInfo irq_type_info = {
    .name = TYPE_IRQ,
    .parent = TYPE_OBJECT,
-   .instance_size = sizeof(struct IRQState),
+   .instance_size = sizeof(IRQState),
 };
 
 static void irq_register_types(void)