From patchwork Fri May 28 20:32:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 102981 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4SKWZVV007877 for ; Fri, 28 May 2010 20:32:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756586Ab0E1Ucf (ORCPT ); Fri, 28 May 2010 16:32:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38963 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756030Ab0E1Uce (ORCPT ); Fri, 28 May 2010 16:32:34 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4SKWX31027885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 May 2010 16:32:33 -0400 Received: from cavan.codon.org.uk (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4SKWWGV011370 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Fri, 28 May 2010 16:32:33 -0400 Received: from 209-6-34-250.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.34.250] helo=localhost.localdomain) by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1OI6EH-0000q4-NZ; Fri, 28 May 2010 21:32:29 +0100 From: Matthew Garrett To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, Matthew Garrett Subject: [PATCH 2/2] ACPI: Store NVS state even when entering suspend to RAM Date: Fri, 28 May 2010 16:32:15 -0400 Message-Id: <1275078735-1866-2-git-send-email-mjg@redhat.com> In-Reply-To: <1275078735-1866-1-git-send-email-mjg@redhat.com> References: <1275078735-1866-1-git-send-email-mjg@redhat.com> X-SA-Do-Not-Run: Yes X-SA-Exim-Connect-IP: 209.6.34.250 X-SA-Exim-Mail-From: mjg@redhat.com X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 28 May 2010 20:32:36 +0000 (UTC) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index d3cbc55..18aa074 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -128,6 +128,8 @@ static int __acpi_pm_prepare(void) { int error = acpi_sleep_prepare(acpi_target_sleep_state); + suspend_nvs_save(); + if (error) acpi_target_sleep_state = ACPI_STATE_S0; return error; @@ -156,6 +158,8 @@ static void acpi_pm_finish(void) { u32 acpi_state = acpi_target_sleep_state; + suspend_nvs_free(); + if (acpi_state == ACPI_STATE_S0) return; @@ -205,6 +209,11 @@ static int acpi_suspend_begin(suspend_state_t pm_state) u32 acpi_state = acpi_suspend_states[pm_state]; int error = 0; + error = suspend_nvs_alloc(); + + if (error) + return error; + if (sleep_states[acpi_state]) { acpi_target_sleep_state = acpi_state; acpi_sleep_tts_switch(acpi_target_sleep_state); @@ -283,6 +292,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state) if (acpi_state == ACPI_STATE_S3) acpi_restore_state_mem(); + suspend_nvs_restore(); + return ACPI_SUCCESS(status) ? 0 : -EFAULT; } @@ -583,12 +594,6 @@ static int acpi_hibernation_enter(void) return ACPI_SUCCESS(status) ? 0 : -EFAULT; } -static void acpi_hibernation_finish(void) -{ - suspend_nvs_free(); - acpi_pm_finish(); -} - static void acpi_hibernation_leave(void) { /* @@ -626,7 +631,7 @@ static struct platform_hibernation_ops acpi_hibernation_ops = { .begin = acpi_hibernation_begin, .end = acpi_pm_end, .pre_snapshot = acpi_hibernation_pre_snapshot, - .finish = acpi_hibernation_finish, + .finish = acpi_pm_finish, .prepare = acpi_pm_prepare, .enter = acpi_hibernation_enter, .leave = acpi_hibernation_leave, @@ -679,7 +684,7 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = { .begin = acpi_hibernation_begin_old, .end = acpi_pm_end, .pre_snapshot = acpi_hibernation_pre_snapshot_old, - .finish = acpi_hibernation_finish, + .finish = acpi_pm_finish, .prepare = acpi_pm_disable_gpes, .enter = acpi_hibernation_enter, .leave = acpi_hibernation_leave,