diff mbox series

[v4,17/32] sparc: Use DEFINE_PROP for nwindows property

Message ID 20201211220529.2290218-18-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show
Series qdev property code cleanup | expand

Commit Message

Eduardo Habkost Dec. 11, 2020, 10:05 p.m. UTC
Use the DEFINE_PROP macro (which will set extra fields in the
struct) instead of initializing a Property struct manually.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
This is a new patch added in v2 of the series
---
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>
Cc: qemu-devel@nongnu.org
---
 target/sparc/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Igor Mammedov Dec. 14, 2020, 2:42 p.m. UTC | #1
On Fri, 11 Dec 2020 17:05:14 -0500
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Use the DEFINE_PROP macro (which will set extra fields in the
> struct) instead of initializing a Property struct manually.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> This is a new patch added in v2 of the series
> ---
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Artyom Tarasenko <atar4qemu@gmail.com>
> Cc: qemu-devel@nongnu.org
> ---
>  target/sparc/cpu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
> index 6a3299041f..92534bcd18 100644
> --- a/target/sparc/cpu.c
> +++ b/target/sparc/cpu.c
> @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = {
>                           qdev_prop_uint64, target_ulong),
>      DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
>      DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
> -    { .name  = "nwindows", .info  = &qdev_prop_nwindows },
> +    DEFINE_PROP("nwindows",     SPARCCPU, env.def.nwindows,
                               ^^^^
stray whitespace

> +                qdev_prop_nwindows, uint32_t),
>      DEFINE_PROP_END_OF_LIST()
>  };
>
Eduardo Habkost Dec. 14, 2020, 5:30 p.m. UTC | #2
On Mon, Dec 14, 2020 at 03:42:48PM +0100, Igor Mammedov wrote:
> On Fri, 11 Dec 2020 17:05:14 -0500
> Eduardo Habkost <ehabkost@redhat.com> wrote:
> 
> > Use the DEFINE_PROP macro (which will set extra fields in the
> > struct) instead of initializing a Property struct manually.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > This is a new patch added in v2 of the series
> > ---
> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> > Cc: Artyom Tarasenko <atar4qemu@gmail.com>
> > Cc: qemu-devel@nongnu.org
> > ---
> >  target/sparc/cpu.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
> > index 6a3299041f..92534bcd18 100644
> > --- a/target/sparc/cpu.c
> > +++ b/target/sparc/cpu.c
> > @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = {
> >                           qdev_prop_uint64, target_ulong),
> >      DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
> >      DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
> > -    { .name  = "nwindows", .info  = &qdev_prop_nwindows },
> > +    DEFINE_PROP("nwindows",     SPARCCPU, env.def.nwindows,
>                                ^^^^
> stray whitespace

I was trying to keep it aligned to the other entries (not visible in diff
context), but I agree it's just confusing.  I will fix this while committing.
Mark Cave-Ayland Dec. 15, 2020, 11:52 a.m. UTC | #3
On 11/12/2020 22:05, Eduardo Habkost wrote:

> Use the DEFINE_PROP macro (which will set extra fields in the
> struct) instead of initializing a Property struct manually.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> This is a new patch added in v2 of the series
> ---
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Artyom Tarasenko <atar4qemu@gmail.com>
> Cc: qemu-devel@nongnu.org
> ---
>   target/sparc/cpu.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
> index 6a3299041f..92534bcd18 100644
> --- a/target/sparc/cpu.c
> +++ b/target/sparc/cpu.c
> @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = {
>                            qdev_prop_uint64, target_ulong),
>       DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
>       DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
> -    { .name  = "nwindows", .info  = &qdev_prop_nwindows },
> +    DEFINE_PROP("nwindows",     SPARCCPU, env.def.nwindows,
> +                qdev_prop_nwindows, uint32_t),
>       DEFINE_PROP_END_OF_LIST()
>   };

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

FWIW as my bandwidth can be intermittent at times, I'm generally happy to give an 
implicit go-ahead for merging the QOM/QDEV improvements since IMO the benefits far 
outweigh any potential problems. So if you don't hear from me then I'm happy for you 
to assume that any SPARC-related changes in this area are implicitly okay to merge :)


ATB,

Mark.
Igor Mammedov Dec. 15, 2020, 2:39 p.m. UTC | #4
On Mon, 14 Dec 2020 12:30:13 -0500
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Mon, Dec 14, 2020 at 03:42:48PM +0100, Igor Mammedov wrote:
> > On Fri, 11 Dec 2020 17:05:14 -0500
> > Eduardo Habkost <ehabkost@redhat.com> wrote:
> >   
> > > Use the DEFINE_PROP macro (which will set extra fields in the
> > > struct) instead of initializing a Property struct manually.
> > > 
> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > > ---
> > > This is a new patch added in v2 of the series
> > > ---
> > > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> > > Cc: Artyom Tarasenko <atar4qemu@gmail.com>
> > > Cc: qemu-devel@nongnu.org
> > > ---
> > >  target/sparc/cpu.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
> > > index 6a3299041f..92534bcd18 100644
> > > --- a/target/sparc/cpu.c
> > > +++ b/target/sparc/cpu.c
> > > @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = {
> > >                           qdev_prop_uint64, target_ulong),
> > >      DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
> > >      DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
> > > -    { .name  = "nwindows", .info  = &qdev_prop_nwindows },
> > > +    DEFINE_PROP("nwindows",     SPARCCPU, env.def.nwindows,  
> >                                ^^^^
> > stray whitespace  
> 
> I was trying to keep it aligned to the other entries (not visible in diff
> context), but I agree it's just confusing.  I will fix this while committing.
> 
With that
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
diff mbox series

Patch

diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 6a3299041f..92534bcd18 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -848,7 +848,8 @@  static Property sparc_cpu_properties[] = {
                          qdev_prop_uint64, target_ulong),
     DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
     DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
-    { .name  = "nwindows", .info  = &qdev_prop_nwindows },
+    DEFINE_PROP("nwindows",     SPARCCPU, env.def.nwindows,
+                qdev_prop_nwindows, uint32_t),
     DEFINE_PROP_END_OF_LIST()
 };