[PATCH] vmstate: Constify some VMStateDescriptions

Keqian Zhu posted 1 patch 2 years, 11 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210408140706.23412-1-zhukeqian1@huawei.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Max Reitz <mreitz@redhat.com>
hw/block/ecc.c           | 2 +-
include/hw/block/flash.h | 2 +-
target/i386/cpu.h        | 2 +-
target/i386/machine.c    | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
[PATCH] vmstate: Constify some VMStateDescriptions
Posted by Keqian Zhu 2 years, 11 months ago
Constify vmstate_ecc_state and vmstate_x86_cpu.

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
 hw/block/ecc.c           | 2 +-
 include/hw/block/flash.h | 2 +-
 target/i386/cpu.h        | 2 +-
 target/i386/machine.c    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/block/ecc.c b/hw/block/ecc.c
index 1a182367ee..6e0d63842c 100644
--- a/hw/block/ecc.c
+++ b/hw/block/ecc.c
@@ -78,7 +78,7 @@ void ecc_reset(ECCState *s)
 }
 
 /* Save/restore */
-VMStateDescription vmstate_ecc_state = {
+const VMStateDescription vmstate_ecc_state = {
     .name = "ecc-state",
     .version_id = 0,
     .minimum_version_id = 0,
diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
index 7dde0adcee..86d8363bb0 100644
--- a/include/hw/block/flash.h
+++ b/include/hw/block/flash.h
@@ -74,6 +74,6 @@ typedef struct {
 
 uint8_t ecc_digest(ECCState *s, uint8_t sample);
 void ecc_reset(ECCState *s);
-extern VMStateDescription vmstate_ecc_state;
+extern const VMStateDescription vmstate_ecc_state;
 
 #endif
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 570f916878..1bc300ce85 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1786,7 +1786,7 @@ struct X86CPU {
 
 
 #ifndef CONFIG_USER_ONLY
-extern VMStateDescription vmstate_x86_cpu;
+extern const VMStateDescription vmstate_x86_cpu;
 #endif
 
 int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request);
diff --git a/target/i386/machine.c b/target/i386/machine.c
index 137604ddb8..f6f094f1c9 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -1396,7 +1396,7 @@ static const VMStateDescription vmstate_msr_tsx_ctrl = {
     }
 };
 
-VMStateDescription vmstate_x86_cpu = {
+const VMStateDescription vmstate_x86_cpu = {
     .name = "cpu",
     .version_id = 12,
     .minimum_version_id = 11,
-- 
2.19.1


Re: [PATCH] vmstate: Constify some VMStateDescriptions
Posted by Philippe Mathieu-Daudé 2 years, 11 months ago
On 4/8/21 4:07 PM, Keqian Zhu wrote:
> Constify vmstate_ecc_state and vmstate_x86_cpu.
> 
> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
> ---
>  hw/block/ecc.c           | 2 +-
>  include/hw/block/flash.h | 2 +-
>  target/i386/cpu.h        | 2 +-
>  target/i386/machine.c    | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Re: [PATCH] vmstate: Constify some VMStateDescriptions
Posted by Laurent Vivier 2 years, 11 months ago
Le 08/04/2021 à 16:07, Keqian Zhu a écrit :
> Constify vmstate_ecc_state and vmstate_x86_cpu.
> 
> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
> ---
>  hw/block/ecc.c           | 2 +-
>  include/hw/block/flash.h | 2 +-
>  target/i386/cpu.h        | 2 +-
>  target/i386/machine.c    | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/block/ecc.c b/hw/block/ecc.c
> index 1a182367ee..6e0d63842c 100644
> --- a/hw/block/ecc.c
> +++ b/hw/block/ecc.c
> @@ -78,7 +78,7 @@ void ecc_reset(ECCState *s)
>  }
>  
>  /* Save/restore */
> -VMStateDescription vmstate_ecc_state = {
> +const VMStateDescription vmstate_ecc_state = {
>      .name = "ecc-state",
>      .version_id = 0,
>      .minimum_version_id = 0,
> diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
> index 7dde0adcee..86d8363bb0 100644
> --- a/include/hw/block/flash.h
> +++ b/include/hw/block/flash.h
> @@ -74,6 +74,6 @@ typedef struct {
>  
>  uint8_t ecc_digest(ECCState *s, uint8_t sample);
>  void ecc_reset(ECCState *s);
> -extern VMStateDescription vmstate_ecc_state;
> +extern const VMStateDescription vmstate_ecc_state;
>  
>  #endif
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 570f916878..1bc300ce85 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -1786,7 +1786,7 @@ struct X86CPU {
>  
>  
>  #ifndef CONFIG_USER_ONLY
> -extern VMStateDescription vmstate_x86_cpu;
> +extern const VMStateDescription vmstate_x86_cpu;
>  #endif
>  
>  int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request);
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index 137604ddb8..f6f094f1c9 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -1396,7 +1396,7 @@ static const VMStateDescription vmstate_msr_tsx_ctrl = {
>      }
>  };
>  
> -VMStateDescription vmstate_x86_cpu = {
> +const VMStateDescription vmstate_x86_cpu = {
>      .name = "cpu",
>      .version_id = 12,
>      .minimum_version_id = 11,
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


Re: [PATCH] vmstate: Constify some VMStateDescriptions
Posted by Richard Henderson 2 years, 11 months ago
On 4/8/21 7:07 AM, Keqian Zhu wrote:
> Constify vmstate_ecc_state and vmstate_x86_cpu.
> 
> Signed-off-by: Keqian Zhu<zhukeqian1@huawei.com>
> ---
>   hw/block/ecc.c           | 2 +-
>   include/hw/block/flash.h | 2 +-
>   target/i386/cpu.h        | 2 +-
>   target/i386/machine.c    | 2 +-
>   4 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~