hw/unicore32/puv3: Simplify puv3_soc_init()
diff mbox series

Message ID 20200221162325.28194-1-philmd@redhat.com
State New
Headers show
Series
  • hw/unicore32/puv3: Simplify puv3_soc_init()
Related show

Commit Message

Philippe Mathieu-Daudé Feb. 21, 2020, 4:23 p.m. UTC
Since commit d8ed887bdc, the puv3_intc_cpu_handler handler takes
a pointer to UniCore32CPU in its opaque argument.  Directly pass
the cpu pointer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/unicore32/puv3.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Laurent Vivier March 3, 2020, 9:56 a.m. UTC | #1
Le 21/02/2020 à 17:23, Philippe Mathieu-Daudé a écrit :
> Since commit d8ed887bdc, the puv3_intc_cpu_handler handler takes
> a pointer to UniCore32CPU in its opaque argument.  Directly pass
> the cpu pointer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/unicore32/puv3.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..eec7f561eb 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -48,7 +48,7 @@ static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
>      }
>  }
>  
> -static void puv3_soc_init(CPUUniCore32State *env)
> +static void puv3_soc_init(UniCore32CPU *cpu)
>  {
>      qemu_irq cpu_intc, irqs[PUV3_IRQS_NR];
>      DeviceState *dev;
> @@ -56,8 +56,7 @@ static void puv3_soc_init(CPUUniCore32State *env)
>      int i;
>  
>      /* Initialize interrupt controller */
> -    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler,
> -                                 env_archcpu(env), 0);
> +    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler, cpu, 0);
>      dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, cpu_intc);
>      for (i = 0; i < PUV3_IRQS_NR; i++) {
>          irqs[i] = qdev_get_gpio_in(dev, i);
> @@ -131,7 +130,7 @@ static void puv3_init(MachineState *machine)
>      cpu = UNICORE32_CPU(cpu_create(machine->cpu_type));
>      env = &cpu->env;
>  
> -    puv3_soc_init(env);
> +    puv3_soc_init(cpu);
>      puv3_board_init(env, ram_size);
>      puv3_load_kernel(kernel_filename);
>  }
> 

I think you can remove totally env as puv3_board_init() doesn't use it.

Thanks,
Laurent

Patch
diff mbox series

diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index 7e933de228..eec7f561eb 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -48,7 +48,7 @@  static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
     }
 }
 
-static void puv3_soc_init(CPUUniCore32State *env)
+static void puv3_soc_init(UniCore32CPU *cpu)
 {
     qemu_irq cpu_intc, irqs[PUV3_IRQS_NR];
     DeviceState *dev;
@@ -56,8 +56,7 @@  static void puv3_soc_init(CPUUniCore32State *env)
     int i;
 
     /* Initialize interrupt controller */
-    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler,
-                                 env_archcpu(env), 0);
+    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler, cpu, 0);
     dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, cpu_intc);
     for (i = 0; i < PUV3_IRQS_NR; i++) {
         irqs[i] = qdev_get_gpio_in(dev, i);
@@ -131,7 +130,7 @@  static void puv3_init(MachineState *machine)
     cpu = UNICORE32_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
 
-    puv3_soc_init(env);
+    puv3_soc_init(cpu);
     puv3_board_init(env, ram_size);
     puv3_load_kernel(kernel_filename);
 }