Skip to content

Commit e555abc

Browse files
committed
hw/tricore/triboard: Remove unnecessary use of &first_cpu
triboard_machine_init() has access to the single CPU via: TriBoardMachineState { TC27XSoCState { TriCoreCPU cpu; ... } tc27x_soc; } ms; Pass it as argument to tricore_load_kernel() so we can remove the &first_cpu global use. Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Pierrick Bouvier <[email protected]> Reviewed-by: Bastian Koppelmann <[email protected]> Message-Id: <[email protected]>
1 parent ef82ab6 commit e555abc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

hw/tricore/triboard.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131
#include "hw/tricore/triboard.h"
3232
#include "hw/tricore/tc27x_soc.h"
3333

34-
static void tricore_load_kernel(const char *kernel_filename)
34+
static void tricore_load_kernel(TriCoreCPU *cpu, const char *kernel_filename)
3535
{
3636
uint64_t entry;
3737
long kernel_size;
38-
TriCoreCPU *cpu;
3938
CPUTriCoreState *env;
4039

4140
kernel_size = load_elf(kernel_filename, NULL,
@@ -46,7 +45,6 @@ static void tricore_load_kernel(const char *kernel_filename)
4645
error_report("no kernel file '%s'", kernel_filename);
4746
exit(1);
4847
}
49-
cpu = TRICORE_CPU(first_cpu);
5048
env = &cpu->env;
5149
env->PC = entry;
5250
}
@@ -62,7 +60,7 @@ static void triboard_machine_init(MachineState *machine)
6260
sysbus_realize(SYS_BUS_DEVICE(&ms->tc27x_soc), &error_fatal);
6361

6462
if (machine->kernel_filename) {
65-
tricore_load_kernel(machine->kernel_filename);
63+
tricore_load_kernel(&ms->tc27x_soc.cpu, machine->kernel_filename);
6664
}
6765
}
6866

0 commit comments

Comments
 (0)