From patchwork Thu Jul 19 15:52:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10150 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7A76A23F4C for ; Thu, 19 Jul 2012 15:52:32 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4109AA18310 for ; Thu, 19 Jul 2012 15:52:32 +0000 (UTC) Received: by ggnf1 with SMTP id f1so3136003ggn.11 for ; Thu, 19 Jul 2012 08:52:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=MkyMTNXmksZO1Jf0xeU7Fnpvtzk0M5pyWzctof5UnLU=; b=JZIMuLBdKquWnGhaL6DDmkmMr36n2cXvjWl9yoE4Qho75DE2Gn720tPMPUlV1x6x9q TSxfrvDqlBEghsOXafY0Sb+JN2cHRG1AqkedS9xinBRtigHdQGRXa6UGbU2K0k5+nIZN qiKwSE37asDvNnidVk0idSOHavT7gsQy1FbGJnRtyZsEWoGBQd1CJATNXz7yOmt7mFoy blmJSVCGMsqqklqyXfD1KuJCQBsD+xRTccs2cmbA/SBjfJ3Sp164wD0Iy9Yy53EZww64 2xXPIh1/YeaqD8UmaKY1ay5is5cp0yOZFpWTHtMV7Bo/oIX3GNdMiqoykNT4anZT6Hyu fYQg== Received: by 10.43.63.140 with SMTP id xe12mr1543457icb.57.1342713151526; Thu, 19 Jul 2012 08:52:31 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.153.7 with SMTP id i7csp12799ibw; Thu, 19 Jul 2012 08:52:30 -0700 (PDT) Received: by 10.216.59.7 with SMTP id r7mr1654440wec.19.1342713149710; Thu, 19 Jul 2012 08:52:29 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id v6si46042613wiw.7.2012.07.19.08.52.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jul 2012 08:52:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1Srt1f-0003q0-3u; Thu, 19 Jul 2012 16:52:27 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini , qemu-trivial@nongnu.org Subject: [PATCH] cpus.c: Make all_cpu_threads_idle() static Date: Thu, 19 Jul 2012 16:52:27 +0100 Message-Id: <1342713147-14729-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQlHGVSWR8mPMNuGaoxQcZ0IL5urAMsRHBXWRYcWsjdelIOXgBGYOqv0BFm1qe+RWiLNzaUS Commit 946fb27c1 moved all the uses of all_cpu_threads_idle() into cpus.c. This means we can mark the function 'static' (again), if we shuffle it a bit earlier in the source file. Signed-off-by: Peter Maydell --- cpus.c | 52 ++++++++++++++++++++++++++-------------------------- qemu-common.h | 1 - 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/cpus.c b/cpus.c index b182b3d..756e624 100644 --- a/cpus.c +++ b/cpus.c @@ -61,6 +61,32 @@ static CPUArchState *next_cpu; +static bool cpu_thread_is_idle(CPUArchState *env) +{ + if (env->stop || env->queued_work_first) { + return false; + } + if (env->stopped || !runstate_is_running()) { + return true; + } + if (!env->halted || qemu_cpu_has_work(env) || kvm_irqchip_in_kernel()) { + return false; + } + return true; +} + +static bool all_cpu_threads_idle(void) +{ + CPUArchState *env; + + for (env = first_cpu; env != NULL; env = env->next_cpu) { + if (!cpu_thread_is_idle(env)) { + return false; + } + } + return true; +} + /***********************************************************/ /* guest cycle counter */ @@ -433,32 +459,6 @@ static int cpu_can_run(CPUArchState *env) return 1; } -static bool cpu_thread_is_idle(CPUArchState *env) -{ - if (env->stop || env->queued_work_first) { - return false; - } - if (env->stopped || !runstate_is_running()) { - return true; - } - if (!env->halted || qemu_cpu_has_work(env) || kvm_irqchip_in_kernel()) { - return false; - } - return true; -} - -bool all_cpu_threads_idle(void) -{ - CPUArchState *env; - - for (env = first_cpu; env != NULL; env = env->next_cpu) { - if (!cpu_thread_is_idle(env)) { - return false; - } - } - return true; -} - static void cpu_handle_guest_debug(CPUArchState *env) { gdb_set_stop_cpu(env); diff --git a/qemu-common.h b/qemu-common.h index 09676f5..7c8dac8 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -293,7 +293,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id); void qemu_cpu_kick(void *env); void qemu_cpu_kick_self(void); int qemu_cpu_is_self(void *env); -bool all_cpu_threads_idle(void); /* work queue */ struct qemu_work_item {