From 05318a858c1212d845d03f924e6ab5f22ab51ab6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andreas=20F=C3=A4rber?= Date: Wed, 29 May 2013 21:03:31 +0200 Subject: [PATCH] spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of looping over all CPUArchState, use a helper to obtain the desired CPUState directly. Saves a CPUPPCState variable and QOM cast. Signed-off-by: Andreas Färber --- hw/ppc/spapr_rtas.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 8ecaa5f..a1c3d20 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -130,7 +130,6 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr, uint32_t nret, target_ulong rets) { target_ulong id; - CPUPPCState *env; CPUState *cpu; if (nargs != 1 || nret != 2) { @@ -139,12 +138,8 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr, } id = rtas_ld(args, 0); - for (env = first_cpu; env; env = env->next_cpu) { - cpu = CPU(ppc_env_get_cpu(env)); - if (cpu->cpu_index != id) { - continue; - } - + cpu = qemu_get_cpu(id); + if (cpu != NULL) { if (cpu->halted) { rtas_st(rets, 1, 0); } else { -- 2.7.4