diff mbox series

hw/riscv: virt: Simplify virt_{get,set}_aclint()

Message ID 20230206085007.3618715-1-bmeng@tinylab.org (mailing list archive)
State New, archived
Headers show
Series hw/riscv: virt: Simplify virt_{get,set}_aclint() | expand

Commit Message

Bin Meng Feb. 6, 2023, 8:50 a.m. UTC
There is no need to declare an intermediate "MachineState *ms".

Signed-off-by: Bin Meng <bmeng@tinylab.org>
---

 hw/riscv/virt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 6, 2023, 9:20 a.m. UTC | #1
On 6/2/23 09:50, Bin Meng wrote:
> There is no need to declare an intermediate "MachineState *ms".
> 
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
> ---
> 
>   hw/riscv/virt.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Alistair Francis Feb. 6, 2023, 10:21 p.m. UTC | #2
On Mon, Feb 6, 2023 at 6:51 PM Bin Meng <bmeng@tinylab.org> wrote:
>
> There is no need to declare an intermediate "MachineState *ms".
>
> Signed-off-by: Bin Meng <bmeng@tinylab.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>
>  hw/riscv/virt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 4a11b4b010..bdb6b93115 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1577,16 +1577,14 @@ static void virt_set_aia(Object *obj, const char *val, Error **errp)
>
>  static bool virt_get_aclint(Object *obj, Error **errp)
>  {
> -    MachineState *ms = MACHINE(obj);
> -    RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
> +    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
>
>      return s->have_aclint;
>  }
>
>  static void virt_set_aclint(Object *obj, bool value, Error **errp)
>  {
> -    MachineState *ms = MACHINE(obj);
> -    RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
> +    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
>
>      s->have_aclint = value;
>  }
> --
> 2.25.1
>
>
Alistair Francis Feb. 7, 2023, 3 a.m. UTC | #3
On Mon, Feb 6, 2023 at 6:51 PM Bin Meng <bmeng@tinylab.org> wrote:
>
> There is no need to declare an intermediate "MachineState *ms".
>
> Signed-off-by: Bin Meng <bmeng@tinylab.org>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>
>  hw/riscv/virt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 4a11b4b010..bdb6b93115 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1577,16 +1577,14 @@ static void virt_set_aia(Object *obj, const char *val, Error **errp)
>
>  static bool virt_get_aclint(Object *obj, Error **errp)
>  {
> -    MachineState *ms = MACHINE(obj);
> -    RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
> +    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
>
>      return s->have_aclint;
>  }
>
>  static void virt_set_aclint(Object *obj, bool value, Error **errp)
>  {
> -    MachineState *ms = MACHINE(obj);
> -    RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
> +    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
>
>      s->have_aclint = value;
>  }
> --
> 2.25.1
>
>
diff mbox series

Patch

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4a11b4b010..bdb6b93115 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1577,16 +1577,14 @@  static void virt_set_aia(Object *obj, const char *val, Error **errp)
 
 static bool virt_get_aclint(Object *obj, Error **errp)
 {
-    MachineState *ms = MACHINE(obj);
-    RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
+    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
 
     return s->have_aclint;
 }
 
 static void virt_set_aclint(Object *obj, bool value, Error **errp)
 {
-    MachineState *ms = MACHINE(obj);
-    RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
+    RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
 
     s->have_aclint = value;
 }