From patchwork Tue May 8 17:50:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 157762 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3D19BB6F9F for ; Wed, 9 May 2012 03:50:53 +1000 (EST) Received: from localhost ([::1]:45536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRoYl-0004Ua-3S for incoming@patchwork.ozlabs.org; Tue, 08 May 2012 13:50:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRoYK-0003s1-3Y for qemu-devel@nongnu.org; Tue, 08 May 2012 13:50:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRoYI-0002cF-B9 for qemu-devel@nongnu.org; Tue, 08 May 2012 13:50:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRoYI-0002by-0s for qemu-devel@nongnu.org; Tue, 08 May 2012 13:50:22 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q48HoKsq019969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 May 2012 13:50:20 -0400 Received: from localhost (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q48HoIXu020515; Tue, 8 May 2012 13:50:19 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Tue, 8 May 2012 14:50:16 -0300 Message-Id: <1336499418-12722-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1336499418-12722-1-git-send-email-lcapitulino@redhat.com> References: <1336499418-12722-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 4/6] vl: drop is_suspended variable 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 Check for the RUN_STATE_SUSPENDED state instead. Signed-off-by: Luiz Capitulino --- vl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index a7afc79..5e0080b 100644 --- a/vl.c +++ b/vl.c @@ -1293,7 +1293,6 @@ static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; static int suspend_requested; -static bool is_suspended; static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = @@ -1427,12 +1426,11 @@ static void qemu_system_suspend(void) notifier_list_notify(&suspend_notifiers, NULL); runstate_set(RUN_STATE_SUSPENDED); monitor_protocol_event(QEVENT_SUSPEND, NULL); - is_suspended = true; } void qemu_system_suspend_request(void) { - if (is_suspended) { + if (runstate_check(RUN_STATE_SUSPENDED)) { return; } suspend_requested = 1; @@ -1447,7 +1445,7 @@ void qemu_register_suspend_notifier(Notifier *notifier) void qemu_system_wakeup_request(WakeupReason reason) { - if (!is_suspended) { + if (!runstate_check(RUN_STATE_SUSPENDED)) { return; } if (!(wakeup_reason_mask & (1 << reason))) { @@ -1458,7 +1456,6 @@ void qemu_system_wakeup_request(WakeupReason reason) notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; qemu_notify_event(); - is_suspended = false; } void qemu_system_wakeup_enable(WakeupReason reason, bool enabled)