qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Trivial cleanups
@ 2023-05-13 10:09 Bernhard Beschow
  2023-05-13 10:09 ` [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class Bernhard Beschow
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Bernhard Beschow @ 2023-05-13 10:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell, Bernhard Beschow

This series:
* Removes dead code from omap_uart and i82378
* Resolves redundant code in the i8254 timer devices
* Replaces string literals by macro usage for TYPE_ISA_PARALLEL devices

Bernhard Beschow (4):
  hw/timer/i8254_common: Share "iobase" property via base class
  hw/arm/omap: Remove unused omap_uart_attach()
  hw/char/parallel: Export TYPE_ISA_PARALLEL macro
  hw/isa/i82378: Remove unused "io" attribute

 include/hw/arm/omap.h      | 1 -
 include/hw/char/parallel.h | 2 ++
 hw/char/omap_uart.c        | 9 ---------
 hw/char/parallel-isa.c     | 2 +-
 hw/char/parallel.c         | 1 -
 hw/i386/kvm/i8254.c        | 1 -
 hw/isa/i82378.c            | 1 -
 hw/isa/isa-superio.c       | 3 ++-
 hw/timer/i8254.c           | 6 ------
 hw/timer/i8254_common.c    | 6 ++++++
 10 files changed, 11 insertions(+), 21 deletions(-)

-- 
2.40.1



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

* [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class
  2023-05-13 10:09 [PATCH 0/4] Trivial cleanups Bernhard Beschow
@ 2023-05-13 10:09 ` Bernhard Beschow
  2023-05-14 12:26   ` Mark Cave-Ayland
  2023-05-15  7:12   ` Philippe Mathieu-Daudé
  2023-05-13 10:09 ` [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach() Bernhard Beschow
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Bernhard Beschow @ 2023-05-13 10:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell, Bernhard Beschow

Both TYPE_KVM_I8254 and TYPE_I8254 have their own but same implementation of
the "iobase" property. The storage for the property already resides in
PITCommonState, so also move the property definition there.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i386/kvm/i8254.c     | 1 -
 hw/timer/i8254.c        | 6 ------
 hw/timer/i8254_common.c | 6 ++++++
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index 191a26fa57..6a7383d877 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -301,7 +301,6 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
 }
 
 static Property kvm_pit_properties[] = {
-    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
                                lost_tick_policy, LOST_TICK_POLICY_DELAY),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
index c8388ea432..c235496fc9 100644
--- a/hw/timer/i8254.c
+++ b/hw/timer/i8254.c
@@ -350,11 +350,6 @@ static void pit_realizefn(DeviceState *dev, Error **errp)
     pc->parent_realize(dev, errp);
 }
 
-static Property pit_properties[] = {
-    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
 static void pit_class_initfn(ObjectClass *klass, void *data)
 {
     PITClass *pc = PIT_CLASS(klass);
@@ -366,7 +361,6 @@ static void pit_class_initfn(ObjectClass *klass, void *data)
     k->get_channel_info = pit_get_channel_info_common;
     k->post_load = pit_post_load;
     dc->reset = pit_reset;
-    device_class_set_props(dc, pit_properties);
 }
 
 static const TypeInfo pit_info = {
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
index 050875b497..e4093e2904 100644
--- a/hw/timer/i8254_common.c
+++ b/hw/timer/i8254_common.c
@@ -240,6 +240,11 @@ static const VMStateDescription vmstate_pit_common = {
     }
 };
 
+static Property pit_common_properties[] = {
+    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void pit_common_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -252,6 +257,7 @@ static void pit_common_class_init(ObjectClass *klass, void *data)
      * done by board code.
      */
     dc->user_creatable = false;
+    device_class_set_props(dc, pit_common_properties);
 }
 
 static const TypeInfo pit_common_type = {
-- 
2.40.1



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

* [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach()
  2023-05-13 10:09 [PATCH 0/4] Trivial cleanups Bernhard Beschow
  2023-05-13 10:09 ` [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class Bernhard Beschow
@ 2023-05-13 10:09 ` Bernhard Beschow
  2023-05-14 12:28   ` Mark Cave-Ayland
  2023-05-15  7:11   ` Philippe Mathieu-Daudé
  2023-05-13 10:09 ` [PATCH 3/4] hw/char/parallel: Export TYPE_ISA_PARALLEL macro Bernhard Beschow
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Bernhard Beschow @ 2023-05-13 10:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell, Bernhard Beschow

The function is unused since commit
bdad3654d3c55f478e538037d9eccd204e5fc8ee ('hw/arm/nseries: Remove
invalid/unnecessary n8x0_uart_setup()').

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/arm/omap.h | 1 -
 hw/char/omap_uart.c   | 9 ---------
 2 files changed, 10 deletions(-)

diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index c275d9b681..067e9419f7 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -724,7 +724,6 @@ struct omap_uart_s *omap2_uart_init(MemoryRegion *sysmem,
                 qemu_irq txdma, qemu_irq rxdma,
                 const char *label, Chardev *chr);
 void omap_uart_reset(struct omap_uart_s *s);
-void omap_uart_attach(struct omap_uart_s *s, Chardev *chr);
 
 struct omap_mpuio_s;
 qemu_irq *omap_mpuio_in_get(struct omap_mpuio_s *s);
diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c
index 1c890b9201..6848bddb4e 100644
--- a/hw/char/omap_uart.c
+++ b/hw/char/omap_uart.c
@@ -175,12 +175,3 @@ struct omap_uart_s *omap2_uart_init(MemoryRegion *sysmem,
 
     return s;
 }
-
-void omap_uart_attach(struct omap_uart_s *s, Chardev *chr)
-{
-    /* TODO: Should reuse or destroy current s->serial */
-    s->serial = serial_mm_init(get_system_memory(), s->base, 2, s->irq,
-                               omap_clk_getrate(s->fclk) / 16,
-                               chr ?: qemu_chr_new("null", "null", NULL),
-                               DEVICE_NATIVE_ENDIAN);
-}
-- 
2.40.1



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

* [PATCH 3/4] hw/char/parallel: Export TYPE_ISA_PARALLEL macro
  2023-05-13 10:09 [PATCH 0/4] Trivial cleanups Bernhard Beschow
  2023-05-13 10:09 ` [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class Bernhard Beschow
  2023-05-13 10:09 ` [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach() Bernhard Beschow
@ 2023-05-13 10:09 ` Bernhard Beschow
  2023-05-14 12:34   ` Mark Cave-Ayland
  2023-05-13 10:09 ` [PATCH 4/4] hw/isa/i82378: Remove unused "io" attribute Bernhard Beschow
  2023-05-18 21:33 ` [PATCH 0/4] Trivial cleanups Michael S. Tsirkin
  4 siblings, 1 reply; 12+ messages in thread
From: Bernhard Beschow @ 2023-05-13 10:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell, Bernhard Beschow

Rather than using a string literal which is prone to typos let's use a macro
instead which is caught by the compiler if mistyped.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/char/parallel.h | 2 ++
 hw/char/parallel-isa.c     | 2 +-
 hw/char/parallel.c         | 1 -
 hw/isa/isa-superio.c       | 3 ++-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h
index 0a23c0f57e..29d2876d00 100644
--- a/include/hw/char/parallel.h
+++ b/include/hw/char/parallel.h
@@ -4,6 +4,8 @@
 #include "hw/isa/isa.h"
 #include "chardev/char.h"
 
+#define TYPE_ISA_PARALLEL "isa-parallel"
+
 void parallel_hds_isa_init(ISABus *bus, int n);
 
 bool parallel_mm_init(MemoryRegion *address_space,
diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c
index 1ccbb96e70..547ae69304 100644
--- a/hw/char/parallel-isa.c
+++ b/hw/char/parallel-isa.c
@@ -21,7 +21,7 @@ static void parallel_init(ISABus *bus, int index, Chardev *chr)
     DeviceState *dev;
     ISADevice *isadev;
 
-    isadev = isa_new("isa-parallel");
+    isadev = isa_new(TYPE_ISA_PARALLEL);
     dev = DEVICE(isadev);
     qdev_prop_set_uint32(dev, "index", index);
     qdev_prop_set_chr(dev, "chardev", chr);
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index af551e7864..3d32589bb3 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -93,7 +93,6 @@ typedef struct ParallelState {
     PortioList portio_list;
 } ParallelState;
 
-#define TYPE_ISA_PARALLEL "isa-parallel"
 OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)
 
 struct ISAParallelState {
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index c81bfe58ef..53b80de0ce 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -20,6 +20,7 @@
 #include "hw/isa/superio.h"
 #include "hw/qdev-properties.h"
 #include "hw/input/i8042.h"
+#include "hw/char/parallel.h"
 #include "hw/char/serial.h"
 #include "trace.h"
 
@@ -51,7 +52,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
             } else {
                 name = g_strdup_printf("parallel%d", i);
             }
-            isa = isa_new("isa-parallel");
+            isa = isa_new(TYPE_ISA_PARALLEL);
             d = DEVICE(isa);
             qdev_prop_set_uint32(d, "index", i);
             if (k->parallel.get_iobase) {
-- 
2.40.1



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

* [PATCH 4/4] hw/isa/i82378: Remove unused "io" attribute
  2023-05-13 10:09 [PATCH 0/4] Trivial cleanups Bernhard Beschow
                   ` (2 preceding siblings ...)
  2023-05-13 10:09 ` [PATCH 3/4] hw/char/parallel: Export TYPE_ISA_PARALLEL macro Bernhard Beschow
@ 2023-05-13 10:09 ` Bernhard Beschow
  2023-05-14 12:35   ` Mark Cave-Ayland
  2023-05-18 21:33 ` [PATCH 0/4] Trivial cleanups Michael S. Tsirkin
  4 siblings, 1 reply; 12+ messages in thread
From: Bernhard Beschow @ 2023-05-13 10:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell, Bernhard Beschow

The attribute isn't used since commit 5c9736789b79ea49cd236ac326f0a414f63b1015
"i82378: Cleanup implementation".

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/isa/i82378.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 5432ab5065..63e0857208 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -34,7 +34,6 @@ struct I82378State {
 
     qemu_irq cpu_intr;
     qemu_irq *isa_irqs_in;
-    MemoryRegion io;
 };
 
 static const VMStateDescription vmstate_i82378 = {
-- 
2.40.1



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

* Re: [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class
  2023-05-13 10:09 ` [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class Bernhard Beschow
@ 2023-05-14 12:26   ` Mark Cave-Ayland
  2023-05-15  7:12   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Cave-Ayland @ 2023-05-14 12:26 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On 13/05/2023 11:09, Bernhard Beschow wrote:

> Both TYPE_KVM_I8254 and TYPE_I8254 have their own but same implementation of
> the "iobase" property. The storage for the property already resides in
> PITCommonState, so also move the property definition there.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/i386/kvm/i8254.c     | 1 -
>   hw/timer/i8254.c        | 6 ------
>   hw/timer/i8254_common.c | 6 ++++++
>   3 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
> index 191a26fa57..6a7383d877 100644
> --- a/hw/i386/kvm/i8254.c
> +++ b/hw/i386/kvm/i8254.c
> @@ -301,7 +301,6 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
>   }
>   
>   static Property kvm_pit_properties[] = {
> -    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
>       DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
>                                  lost_tick_policy, LOST_TICK_POLICY_DELAY),
>       DEFINE_PROP_END_OF_LIST(),
> diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
> index c8388ea432..c235496fc9 100644
> --- a/hw/timer/i8254.c
> +++ b/hw/timer/i8254.c
> @@ -350,11 +350,6 @@ static void pit_realizefn(DeviceState *dev, Error **errp)
>       pc->parent_realize(dev, errp);
>   }
>   
> -static Property pit_properties[] = {
> -    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
> -    DEFINE_PROP_END_OF_LIST(),
> -};
> -
>   static void pit_class_initfn(ObjectClass *klass, void *data)
>   {
>       PITClass *pc = PIT_CLASS(klass);
> @@ -366,7 +361,6 @@ static void pit_class_initfn(ObjectClass *klass, void *data)
>       k->get_channel_info = pit_get_channel_info_common;
>       k->post_load = pit_post_load;
>       dc->reset = pit_reset;
> -    device_class_set_props(dc, pit_properties);
>   }
>   
>   static const TypeInfo pit_info = {
> diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
> index 050875b497..e4093e2904 100644
> --- a/hw/timer/i8254_common.c
> +++ b/hw/timer/i8254_common.c
> @@ -240,6 +240,11 @@ static const VMStateDescription vmstate_pit_common = {
>       }
>   };
>   
> +static Property pit_common_properties[] = {
> +    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
> +    DEFINE_PROP_END_OF_LIST(),
> +};
> +
>   static void pit_common_class_init(ObjectClass *klass, void *data)
>   {
>       DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -252,6 +257,7 @@ static void pit_common_class_init(ObjectClass *klass, void *data)
>        * done by board code.
>        */
>       dc->user_creatable = false;
> +    device_class_set_props(dc, pit_common_properties);
>   }
>   
>   static const TypeInfo pit_common_type = {

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.



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

* Re: [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach()
  2023-05-13 10:09 ` [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach() Bernhard Beschow
@ 2023-05-14 12:28   ` Mark Cave-Ayland
  2023-05-15  7:11   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Cave-Ayland @ 2023-05-14 12:28 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On 13/05/2023 11:09, Bernhard Beschow wrote:

> The function is unused since commit
> bdad3654d3c55f478e538037d9eccd204e5fc8ee ('hw/arm/nseries: Remove
> invalid/unnecessary n8x0_uart_setup()').
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/arm/omap.h | 1 -
>   hw/char/omap_uart.c   | 9 ---------
>   2 files changed, 10 deletions(-)
> 
> diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
> index c275d9b681..067e9419f7 100644
> --- a/include/hw/arm/omap.h
> +++ b/include/hw/arm/omap.h
> @@ -724,7 +724,6 @@ struct omap_uart_s *omap2_uart_init(MemoryRegion *sysmem,
>                   qemu_irq txdma, qemu_irq rxdma,
>                   const char *label, Chardev *chr);
>   void omap_uart_reset(struct omap_uart_s *s);
> -void omap_uart_attach(struct omap_uart_s *s, Chardev *chr);
>   
>   struct omap_mpuio_s;
>   qemu_irq *omap_mpuio_in_get(struct omap_mpuio_s *s);
> diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c
> index 1c890b9201..6848bddb4e 100644
> --- a/hw/char/omap_uart.c
> +++ b/hw/char/omap_uart.c
> @@ -175,12 +175,3 @@ struct omap_uart_s *omap2_uart_init(MemoryRegion *sysmem,
>   
>       return s;
>   }
> -
> -void omap_uart_attach(struct omap_uart_s *s, Chardev *chr)
> -{
> -    /* TODO: Should reuse or destroy current s->serial */
> -    s->serial = serial_mm_init(get_system_memory(), s->base, 2, s->irq,
> -                               omap_clk_getrate(s->fclk) / 16,
> -                               chr ?: qemu_chr_new("null", "null", NULL),
> -                               DEVICE_NATIVE_ENDIAN);
> -}

A quick grep agrees, so:

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.



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

* Re: [PATCH 3/4] hw/char/parallel: Export TYPE_ISA_PARALLEL macro
  2023-05-13 10:09 ` [PATCH 3/4] hw/char/parallel: Export TYPE_ISA_PARALLEL macro Bernhard Beschow
@ 2023-05-14 12:34   ` Mark Cave-Ayland
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Cave-Ayland @ 2023-05-14 12:34 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On 13/05/2023 11:09, Bernhard Beschow wrote:

> Rather than using a string literal which is prone to typos let's use a macro
> instead which is caught by the compiler if mistyped.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/char/parallel.h | 2 ++
>   hw/char/parallel-isa.c     | 2 +-
>   hw/char/parallel.c         | 1 -
>   hw/isa/isa-superio.c       | 3 ++-
>   4 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h
> index 0a23c0f57e..29d2876d00 100644
> --- a/include/hw/char/parallel.h
> +++ b/include/hw/char/parallel.h
> @@ -4,6 +4,8 @@
>   #include "hw/isa/isa.h"
>   #include "chardev/char.h"
>   
> +#define TYPE_ISA_PARALLEL "isa-parallel"
> +

We don't really want to separate the QOM TYPE_* constant macro and the OBJECT_* 
declaration macro.

It looks like the real issue is that ParallelState should be in 
include/hw/char/parallel.h, and ISAParallelState along with its QOM macros should be 
in a new include/hw/char/parallel-isa.h header.

Once that is done then using the TYPE_ISA_PARALLEL QOM macro will "just work".

>   void parallel_hds_isa_init(ISABus *bus, int n);
>   
>   bool parallel_mm_init(MemoryRegion *address_space,
> diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c
> index 1ccbb96e70..547ae69304 100644
> --- a/hw/char/parallel-isa.c
> +++ b/hw/char/parallel-isa.c
> @@ -21,7 +21,7 @@ static void parallel_init(ISABus *bus, int index, Chardev *chr)
>       DeviceState *dev;
>       ISADevice *isadev;
>   
> -    isadev = isa_new("isa-parallel");
> +    isadev = isa_new(TYPE_ISA_PARALLEL);
>       dev = DEVICE(isadev);
>       qdev_prop_set_uint32(dev, "index", index);
>       qdev_prop_set_chr(dev, "chardev", chr);
> diff --git a/hw/char/parallel.c b/hw/char/parallel.c
> index af551e7864..3d32589bb3 100644
> --- a/hw/char/parallel.c
> +++ b/hw/char/parallel.c
> @@ -93,7 +93,6 @@ typedef struct ParallelState {
>       PortioList portio_list;
>   } ParallelState;
>   
> -#define TYPE_ISA_PARALLEL "isa-parallel"
>   OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)
>   
>   struct ISAParallelState {
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> index c81bfe58ef..53b80de0ce 100644
> --- a/hw/isa/isa-superio.c
> +++ b/hw/isa/isa-superio.c
> @@ -20,6 +20,7 @@
>   #include "hw/isa/superio.h"
>   #include "hw/qdev-properties.h"
>   #include "hw/input/i8042.h"
> +#include "hw/char/parallel.h"
>   #include "hw/char/serial.h"
>   #include "trace.h"
>   
> @@ -51,7 +52,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
>               } else {
>                   name = g_strdup_printf("parallel%d", i);
>               }
> -            isa = isa_new("isa-parallel");
> +            isa = isa_new(TYPE_ISA_PARALLEL);
>               d = DEVICE(isa);
>               qdev_prop_set_uint32(d, "index", i);
>               if (k->parallel.get_iobase) {


ATB,

Mark.



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

* Re: [PATCH 4/4] hw/isa/i82378: Remove unused "io" attribute
  2023-05-13 10:09 ` [PATCH 4/4] hw/isa/i82378: Remove unused "io" attribute Bernhard Beschow
@ 2023-05-14 12:35   ` Mark Cave-Ayland
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Cave-Ayland @ 2023-05-14 12:35 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On 13/05/2023 11:09, Bernhard Beschow wrote:

> The attribute isn't used since commit 5c9736789b79ea49cd236ac326f0a414f63b1015
> "i82378: Cleanup implementation".
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/isa/i82378.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
> index 5432ab5065..63e0857208 100644
> --- a/hw/isa/i82378.c
> +++ b/hw/isa/i82378.c
> @@ -34,7 +34,6 @@ struct I82378State {
>   
>       qemu_irq cpu_intr;
>       qemu_irq *isa_irqs_in;
> -    MemoryRegion io;
>   };
>   
>   static const VMStateDescription vmstate_i82378 = {

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.



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

* Re: [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach()
  2023-05-13 10:09 ` [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach() Bernhard Beschow
  2023-05-14 12:28   ` Mark Cave-Ayland
@ 2023-05-15  7:11   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-15  7:11 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On 13/5/23 12:09, Bernhard Beschow wrote:
> The function is unused since commit
> bdad3654d3c55f478e538037d9eccd204e5fc8ee ('hw/arm/nseries: Remove
> invalid/unnecessary n8x0_uart_setup()').
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/arm/omap.h | 1 -
>   hw/char/omap_uart.c   | 9 ---------
>   2 files changed, 10 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class
  2023-05-13 10:09 ` [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class Bernhard Beschow
  2023-05-14 12:26   ` Mark Cave-Ayland
@ 2023-05-15  7:12   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-15  7:12 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, qemu-arm, Marcel Apfelbaum,
	Michael S. Tsirkin, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On 13/5/23 12:09, Bernhard Beschow wrote:
> Both TYPE_KVM_I8254 and TYPE_I8254 have their own but same implementation of
> the "iobase" property. The storage for the property already resides in
> PITCommonState, so also move the property definition there.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/i386/kvm/i8254.c     | 1 -
>   hw/timer/i8254.c        | 6 ------
>   hw/timer/i8254_common.c | 6 ++++++
>   3 files changed, 6 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 0/4] Trivial cleanups
  2023-05-13 10:09 [PATCH 0/4] Trivial cleanups Bernhard Beschow
                   ` (3 preceding siblings ...)
  2023-05-13 10:09 ` [PATCH 4/4] hw/isa/i82378: Remove unused "io" attribute Bernhard Beschow
@ 2023-05-18 21:33 ` Michael S. Tsirkin
  4 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2023-05-18 21:33 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: qemu-devel, Paolo Bonzini, Richard Henderson, qemu-arm,
	Marcel Apfelbaum, Hervé Poussineau, Michael Tokarev,
	Laurent Vivier, Eduardo Habkost, qemu-trivial, qemu-ppc,
	Marc-André Lureau, Peter Maydell

On Sat, May 13, 2023 at 12:09:02PM +0200, Bernhard Beschow wrote:
> This series:
> * Removes dead code from omap_uart and i82378
> * Resolves redundant code in the i8254 timer devices
> * Replaces string literals by macro usage for TYPE_ISA_PARALLEL devices
> 
> Bernhard Beschow (4):
>   hw/timer/i8254_common: Share "iobase" property via base class
>   hw/arm/omap: Remove unused omap_uart_attach()
>   hw/char/parallel: Export TYPE_ISA_PARALLEL macro
>   hw/isa/i82378: Remove unused "io" attribute


Acked-by: Michael S. Tsirkin <mst@redhat.com>

>  include/hw/arm/omap.h      | 1 -
>  include/hw/char/parallel.h | 2 ++
>  hw/char/omap_uart.c        | 9 ---------
>  hw/char/parallel-isa.c     | 2 +-
>  hw/char/parallel.c         | 1 -
>  hw/i386/kvm/i8254.c        | 1 -
>  hw/isa/i82378.c            | 1 -
>  hw/isa/isa-superio.c       | 3 ++-
>  hw/timer/i8254.c           | 6 ------
>  hw/timer/i8254_common.c    | 6 ++++++
>  10 files changed, 11 insertions(+), 21 deletions(-)
> 
> -- 
> 2.40.1
> 



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

end of thread, other threads:[~2023-05-18 21:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-13 10:09 [PATCH 0/4] Trivial cleanups Bernhard Beschow
2023-05-13 10:09 ` [PATCH 1/4] hw/timer/i8254_common: Share "iobase" property via base class Bernhard Beschow
2023-05-14 12:26   ` Mark Cave-Ayland
2023-05-15  7:12   ` Philippe Mathieu-Daudé
2023-05-13 10:09 ` [PATCH 2/4] hw/arm/omap: Remove unused omap_uart_attach() Bernhard Beschow
2023-05-14 12:28   ` Mark Cave-Ayland
2023-05-15  7:11   ` Philippe Mathieu-Daudé
2023-05-13 10:09 ` [PATCH 3/4] hw/char/parallel: Export TYPE_ISA_PARALLEL macro Bernhard Beschow
2023-05-14 12:34   ` Mark Cave-Ayland
2023-05-13 10:09 ` [PATCH 4/4] hw/isa/i82378: Remove unused "io" attribute Bernhard Beschow
2023-05-14 12:35   ` Mark Cave-Ayland
2023-05-18 21:33 ` [PATCH 0/4] Trivial cleanups Michael S. Tsirkin

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).