diff mbox series

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

Message ID 20200813222625.243136-19-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show
Series qom: Automated conversion of type checking boilerplate | expand

Commit Message

Eduardo Habkost Aug. 13, 2020, 10:26 p.m. UTC
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(-)

Comments

Philippe Mathieu-Daudé Aug. 14, 2020, 6:02 p.m. UTC | #1
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);
>
Daniel P. Berrangé Aug. 17, 2020, 4 p.m. UTC | #2
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
diff mbox series

Patch

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