From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umvff-0008J8-L8 for qemu-devel@nongnu.org; Wed, 12 Jun 2013 20:45:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umvfc-0005Xt-TK for qemu-devel@nongnu.org; Wed, 12 Jun 2013 20:45:47 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 13 Jun 2013 02:45:28 +0200 Message-Id: <1371084329-814-17-git-send-email-afaerber@suse.de> In-Reply-To: <1371084329-814-1-git-send-email-afaerber@suse.de> References: <1371084329-814-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 16/17] spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexander Graf , "open list:sPAPR" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson 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=C3=A4rber --- 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(sPAPREnviron= ment *spapr, uint32_t nret, target_ulong ret= s) { target_ulong id; - CPUPPCState *env; CPUState *cpu; =20 if (nargs !=3D 1 || nret !=3D 2) { @@ -139,12 +138,8 @@ static void rtas_query_cpu_stopped_state(sPAPREnviro= nment *spapr, } =20 id =3D rtas_ld(args, 0); - for (env =3D first_cpu; env; env =3D env->next_cpu) { - cpu =3D CPU(ppc_env_get_cpu(env)); - if (cpu->cpu_index !=3D id) { - continue; - } - + cpu =3D qemu_get_cpu(id); + if (cpu !=3D NULL) { if (cpu->halted) { rtas_st(rets, 1, 0); } else { --=20 1.8.1.4