Message ID | 20200813222625.243136-16-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
Series | qom: Automated conversion of type checking boilerplate | expand |
On 8/14/20 12:25 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> > --- > hw/net/tulip.h | 1 + > hw/net/tulip.c | 4 ++-- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/hw/net/tulip.h b/hw/net/tulip.h > index 5271aad8d5..c3fcd4d4e1 100644 > --- a/hw/net/tulip.h > +++ b/hw/net/tulip.h > @@ -5,6 +5,7 @@ > #include "net/net.h" > > #define TYPE_TULIP "tulip" > +typedef struct TULIPState TULIPState; > #define TULIP(obj) OBJECT_CHECK(TULIPState, (obj), TYPE_TULIP) > > #define CSR(_x) ((_x) << 3) > diff --git a/hw/net/tulip.c b/hw/net/tulip.c > index 4487fd61cf..ca69f7ea5e 100644 > --- a/hw/net/tulip.c > +++ b/hw/net/tulip.c > @@ -18,7 +18,7 @@ > #include "trace.h" > #include "net/eth.h" > > -typedef struct TULIPState { > +struct TULIPState { > PCIDevice dev; > MemoryRegion io; > MemoryRegion memory; > @@ -44,7 +44,7 @@ typedef struct TULIPState { > > uint32_t rx_status; > uint8_t filter[16][6]; > -} TULIPState; > +}; > > static const VMStateDescription vmstate_pci_tulip = { > .name = "tulip", >
On Thu, Aug 13, 2020 at 06:25:59PM -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> > --- > hw/net/tulip.h | 1 + > hw/net/tulip.c | 4 ++-- > 2 files changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel
diff --git a/hw/net/tulip.h b/hw/net/tulip.h index 5271aad8d5..c3fcd4d4e1 100644 --- a/hw/net/tulip.h +++ b/hw/net/tulip.h @@ -5,6 +5,7 @@ #include "net/net.h" #define TYPE_TULIP "tulip" +typedef struct TULIPState TULIPState; #define TULIP(obj) OBJECT_CHECK(TULIPState, (obj), TYPE_TULIP) #define CSR(_x) ((_x) << 3) diff --git a/hw/net/tulip.c b/hw/net/tulip.c index 4487fd61cf..ca69f7ea5e 100644 --- a/hw/net/tulip.c +++ b/hw/net/tulip.c @@ -18,7 +18,7 @@ #include "trace.h" #include "net/eth.h" -typedef struct TULIPState { +struct TULIPState { PCIDevice dev; MemoryRegion io; MemoryRegion memory; @@ -44,7 +44,7 @@ typedef struct TULIPState { uint32_t rx_status; uint8_t filter[16][6]; -} TULIPState; +}; static const VMStateDescription vmstate_pci_tulip = { .name = "tulip",
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> --- hw/net/tulip.h | 1 + hw/net/tulip.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)