From patchwork Thu Jun 13 00:45:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 250940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9AE902C009C for ; Thu, 13 Jun 2013 10:48:17 +1000 (EST) Received: from localhost ([::1]:48095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umvi3-0002zw-NG for incoming@patchwork.ozlabs.org; Wed, 12 Jun 2013 20:48:15 -0400 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 Received: from cantor2.suse.de ([195.135.220.15]:32939 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umvfc-0005Xb-JA; Wed, 12 Jun 2013 20:45:44 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0E2D7A5387; Thu, 13 Jun 2013 02:45:44 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2013 02:45:28 +0200 Message-Id: <1371084329-814-17-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Alexander Graf , "open list:sPAPR" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson Subject: [Qemu-devel] [PULL 16/17] spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 {