[PATCH 18/41] i8254: Move PITCommonState/PITCommonClass typedefs to i8254.h

Eduardo Habkost posted 41 patches 5 years, 5 months ago
Maintainers: Michael Rolnik <mrolnik@gmail.com>, Li Zhijian <lizhijian@cn.fujitsu.com>, Colin Xu <colin.xu@intel.com>, Alberto Garcia <berto@igalia.com>, Juan Quintela <quintela@redhat.com>, Paul Burton <pburton@wavecomp.com>, Andrew Baumann <Andrew.Baumann@microsoft.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, David Gibson <david@gibson.dropbear.id.au>, Eric Farman <farman@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Fam Zheng <fam@euphon.net>, Samuel Thibault <samuel.thibault@ens-lyon.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Hannes Reinecke <hare@suse.com>, Anthony Perard <anthony.perard@citrix.com>, Anup Patel <anup.patel@wdc.com>, Ben Warren <ben@skyportsystems.com>, BALATON Zoltan <balaton@eik.bme.hu>, Christian Borntraeger <borntraeger@de.ibm.com>, Stefan Hajnoczi <stefanha@redhat.com>, Wenchao Wang <wenchao.wang@intel.com>, Magnus Damm <magnus.damm@gmail.com>, Peter Chubb <peter.chubb@nicta.com.au>, Igor Mammedov <imammedo@redhat.com>, Jan Kiszka <jan.kiszka@web.de>, Greg Kurz <groug@kaod.org>, Richard Henderson <rth@twiddle.net>, "Hervé Poussineau" <hpoussin@reactos.org>, Peter Xu <peterx@redhat.com>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Eduardo Habkost <ehabkost@redhat.com>, "Cédric Le Goater" <clg@kaod.org>, Michael Walle <michael@walle.cc>, Beniamino Galvani <b.galvani@gmail.com>, Rob Herring <robh@kernel.org>, Tony Krowiak <akrowiak@linux.ibm.com>, "Alex Bennée" <alex.bennee@linaro.org>, Antony Pavlov <antonynpavlov@gmail.com>, Jason Wang <jasowang@redhat.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Jiri Pirko <jiri@resnulli.us>, Xiao Guangrong <xiaoguangrong.eric@gmail.com>, Max Reitz <mreitz@redhat.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Thomas Huth <huth@tuxfamily.org>, Radoslaw Biernacki <rad@semihalf.com>, Leif Lindholm <leif@nuviainc.com>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Kevin Wolf <kwolf@redhat.com>, Keith Busch <kbusch@kernel.org>, Thomas Huth <thuth@redhat.com>, Anthony Green <green@moxielogic.com>, Amit Shah <amit@kernel.org>, Marek Vasut <marex@denx.de>, Aurelien Jarno <aurelien@aurel32.net>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Yuval Shaia <yuval.shaia.ml@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Artyom Tarasenko <atar4qemu@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Sarah Harris <S.E.Harris@kent.ac.uk>, Gerd Hoffmann <kraxel@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, John Snow <jsnow@redhat.com>, Zhang Chen <chen.zhang@intel.com>, "Michael S. Tsirkin" <mst@redhat.com>, Helge Deller <deller@gmx.de>, Matthew Rosato <mjrosato@linux.ibm.com>, Sergio Lopez <slp@redhat.com>, Huacai Chen <chenhc@lemote.com>, Andrew Jeffery <andrew@aj.id.au>, Laurent Vivier <laurent@vivier.eu>, Paul Durrant <paul@xen.org>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Sven Schnelle <svens@stackframe.org>, Stefan Berger <stefanb@linux.ibm.com>, Peter Maydell <peter.maydell@linaro.org>, Joel Stanley <joel@jms.id.au>, Jean-Christophe Dubois <jcd@tribudubois.net>, Cornelia Huck <cohuck@redhat.com>, Stafford Horne <shorne@gmail.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, Laurent Vivier <lvivier@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Eric Auger <eric.auger@redhat.com>, Fabien Chouteau <chouteau@adacore.com>, Roman Bolshakov <r.bolshakov@yadro.com>, Cameron Esfahani <dirty@apple.com>, Stefano Stabellini <sstabellini@kernel.org>, Corey Minyard <cminyard@mvista.com>, "Gonglei (Arei)" <arei.gonglei@huawei.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, KONRAD Frederic <frederic.konrad@adacore.com>, Andrzej Zaborowski <balrogg@gmail.com>, Jiri Slaby <jslaby@suse.cz>, Sunil Muthuswamy <sunilmut@microsoft.com>, Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>, Chris Wulff <crwulff@gmail.com>, Pierre Morel <pmorel@linux.ibm.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Alistair Francis <alistair@alistair23.me>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Alistair Francis <Alistair.Francis@wdc.com>, Laszlo Ersek <lersek@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Niek Linnenbank <nieklinnenbank@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>
There is a newer version of this series
[PATCH 18/41] i8254: Move PITCommonState/PITCommonClass typedefs to i8254.h
Posted by Eduardo Habkost 5 years, 5 months ago
Move typedef closer to the type check macros, to make it easier
to convert the code to OBJECT_DEFINE_TYPE() in the future.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/timer/i8254.h          | 2 ++
 include/hw/timer/i8254_internal.h | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index e75b4a5a08..206b8f8464 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -39,6 +39,8 @@ typedef struct PITChannelInfo {
 } PITChannelInfo;
 
 #define TYPE_PIT_COMMON "pit-common"
+typedef struct PITCommonState PITCommonState;
+typedef struct PITCommonClass PITCommonClass;
 #define PIT_COMMON(obj) \
      OBJECT_CHECK(PITCommonState, (obj), TYPE_PIT_COMMON)
 #define PIT_COMMON_CLASS(klass) \
diff --git a/include/hw/timer/i8254_internal.h b/include/hw/timer/i8254_internal.h
index 3db462aecd..a9a600d941 100644
--- a/include/hw/timer/i8254_internal.h
+++ b/include/hw/timer/i8254_internal.h
@@ -50,14 +50,14 @@ typedef struct PITChannelState {
     uint32_t irq_disabled;
 } PITChannelState;
 
-typedef struct PITCommonState {
+struct PITCommonState {
     ISADevice dev;
     MemoryRegion ioports;
     uint32_t iobase;
     PITChannelState channels[3];
-} PITCommonState;
+};
 
-typedef struct PITCommonClass {
+struct PITCommonClass {
     ISADeviceClass parent_class;
 
     void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val);
@@ -65,7 +65,7 @@ typedef struct PITCommonClass {
                              PITChannelInfo *info);
     void (*pre_save)(PITCommonState *s);
     void (*post_load)(PITCommonState *s);
-} PITCommonClass;
+};
 
 int pit_get_out(PITChannelState *s, int64_t current_time);
 int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time);
-- 
2.26.2


Re: [PATCH 18/41] i8254: Move PITCommonState/PITCommonClass typedefs to i8254.h
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
On 8/14/20 12:26 AM, Eduardo Habkost wrote:
> Move typedef closer to the type check macros, to make it easier
> to convert the code to OBJECT_DEFINE_TYPE() in the future.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  include/hw/timer/i8254.h          | 2 ++
>  include/hw/timer/i8254_internal.h | 8 ++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
> index e75b4a5a08..206b8f8464 100644
> --- a/include/hw/timer/i8254.h
> +++ b/include/hw/timer/i8254.h
> @@ -39,6 +39,8 @@ typedef struct PITChannelInfo {
>  } PITChannelInfo;
>  
>  #define TYPE_PIT_COMMON "pit-common"
> +typedef struct PITCommonState PITCommonState;
> +typedef struct PITCommonClass PITCommonClass;
>  #define PIT_COMMON(obj) \
>       OBJECT_CHECK(PITCommonState, (obj), TYPE_PIT_COMMON)
>  #define PIT_COMMON_CLASS(klass) \
> diff --git a/include/hw/timer/i8254_internal.h b/include/hw/timer/i8254_internal.h
> index 3db462aecd..a9a600d941 100644
> --- a/include/hw/timer/i8254_internal.h
> +++ b/include/hw/timer/i8254_internal.h
> @@ -50,14 +50,14 @@ typedef struct PITChannelState {
>      uint32_t irq_disabled;
>  } PITChannelState;
>  
> -typedef struct PITCommonState {
> +struct PITCommonState {
>      ISADevice dev;
>      MemoryRegion ioports;
>      uint32_t iobase;
>      PITChannelState channels[3];
> -} PITCommonState;
> +};
>  
> -typedef struct PITCommonClass {
> +struct PITCommonClass {
>      ISADeviceClass parent_class;
>  
>      void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val);
> @@ -65,7 +65,7 @@ typedef struct PITCommonClass {
>                               PITChannelInfo *info);
>      void (*pre_save)(PITCommonState *s);
>      void (*post_load)(PITCommonState *s);
> -} PITCommonClass;
> +};
>  
>  int pit_get_out(PITChannelState *s, int64_t current_time);
>  int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time);
> 


Re: [PATCH 18/41] i8254: Move PITCommonState/PITCommonClass typedefs to i8254.h
Posted by Daniel P. Berrangé 5 years, 5 months ago
On Thu, Aug 13, 2020 at 06:26:02PM -0400, Eduardo Habkost wrote:
> Move typedef closer to the type check macros, to make it easier
> to convert the code to OBJECT_DEFINE_TYPE() in the future.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  include/hw/timer/i8254.h          | 2 ++
>  include/hw/timer/i8254_internal.h | 8 ++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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 :|