[PATCH v2 04/12] hw/char/parallel: Free struct ParallelState from PortioList

Bernhard Beschow posted 12 patches 11 months, 2 weeks ago
Maintainers: Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Leonardo Bras <leobras@redhat.com>, John Snow <jsnow@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, BALATON Zoltan <balaton@eik.bme.hu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, David Hildenbrand <david@redhat.com>
There is a newer version of this series
[PATCH v2 04/12] hw/char/parallel: Free struct ParallelState from PortioList
Posted by Bernhard Beschow 11 months, 2 weeks ago
ParallelState::portio_list isn't used inside ParallelState context but only
inside ISAParallelState context, so more it there.

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

diff --git a/include/hw/char/parallel-isa.h b/include/hw/char/parallel-isa.h
index d24ccecf05..3b783bd08d 100644
--- a/include/hw/char/parallel-isa.h
+++ b/include/hw/char/parallel-isa.h
@@ -12,6 +12,7 @@
 
 #include "parallel.h"
 
+#include "exec/ioport.h"
 #include "hw/isa/isa.h"
 #include "qom/object.h"
 
@@ -25,6 +26,7 @@ struct ISAParallelState {
     uint32_t iobase;
     uint32_t isairq;
     ParallelState state;
+    PortioList portio_list;
 };
 
 #endif /* HW_PARALLEL_ISA_H */
diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h
index 7b5a309a03..cfb97cc7cc 100644
--- a/include/hw/char/parallel.h
+++ b/include/hw/char/parallel.h
@@ -1,7 +1,6 @@
 #ifndef HW_PARALLEL_H
 #define HW_PARALLEL_H
 
-#include "exec/ioport.h"
 #include "exec/memory.h"
 #include "hw/isa/isa.h"
 #include "hw/irq.h"
@@ -22,7 +21,6 @@ typedef struct ParallelState {
     uint32_t last_read_offset; /* For debugging */
     /* Memory-mapped interface */
     int it_shift;
-    PortioList portio_list;
 } ParallelState;
 
 void parallel_hds_isa_init(ISABus *bus, int n);
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index 147c900f0d..c1747cbb75 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -532,7 +532,7 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp)
         s->status = dummy;
     }
 
-    isa_register_portio_list(isadev, &s->portio_list, base,
+    isa_register_portio_list(isadev, &isa->portio_list, base,
                              (s->hw_driver
                               ? &isa_parallel_portio_hw_list[0]
                               : &isa_parallel_portio_sw_list[0]),
-- 
2.43.0
Re: [PATCH v2 04/12] hw/char/parallel: Free struct ParallelState from PortioList
Posted by BALATON Zoltan 11 months, 1 week ago
On Mon, 18 Dec 2023, Bernhard Beschow wrote:
> ParallelState::portio_list isn't used inside ParallelState context but only
> inside ISAParallelState context, so more it there.

Same comments as for patch 1 otherwise

Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> include/hw/char/parallel-isa.h | 2 ++
> include/hw/char/parallel.h     | 2 --
> hw/char/parallel.c             | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/hw/char/parallel-isa.h b/include/hw/char/parallel-isa.h
> index d24ccecf05..3b783bd08d 100644
> --- a/include/hw/char/parallel-isa.h
> +++ b/include/hw/char/parallel-isa.h
> @@ -12,6 +12,7 @@
>
> #include "parallel.h"
>
> +#include "exec/ioport.h"
> #include "hw/isa/isa.h"
> #include "qom/object.h"
>
> @@ -25,6 +26,7 @@ struct ISAParallelState {
>     uint32_t iobase;
>     uint32_t isairq;
>     ParallelState state;
> +    PortioList portio_list;
> };
>
> #endif /* HW_PARALLEL_ISA_H */
> diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h
> index 7b5a309a03..cfb97cc7cc 100644
> --- a/include/hw/char/parallel.h
> +++ b/include/hw/char/parallel.h
> @@ -1,7 +1,6 @@
> #ifndef HW_PARALLEL_H
> #define HW_PARALLEL_H
>
> -#include "exec/ioport.h"
> #include "exec/memory.h"
> #include "hw/isa/isa.h"
> #include "hw/irq.h"
> @@ -22,7 +21,6 @@ typedef struct ParallelState {
>     uint32_t last_read_offset; /* For debugging */
>     /* Memory-mapped interface */
>     int it_shift;
> -    PortioList portio_list;
> } ParallelState;
>
> void parallel_hds_isa_init(ISABus *bus, int n);
> diff --git a/hw/char/parallel.c b/hw/char/parallel.c
> index 147c900f0d..c1747cbb75 100644
> --- a/hw/char/parallel.c
> +++ b/hw/char/parallel.c
> @@ -532,7 +532,7 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp)
>         s->status = dummy;
>     }
>
> -    isa_register_portio_list(isadev, &s->portio_list, base,
> +    isa_register_portio_list(isadev, &isa->portio_list, base,
>                              (s->hw_driver
>                               ? &isa_parallel_portio_hw_list[0]
>                               : &isa_parallel_portio_sw_list[0]),
>