From patchwork Tue Jun 1 18:22:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 103588 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 o51IMdgF020749 for ; Tue, 1 Jun 2010 18:22:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752995Ab0FASWl (ORCPT ); Tue, 1 Jun 2010 14:22:41 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:33775 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635Ab0FASWk (ORCPT ); Tue, 1 Jun 2010 14:22:40 -0400 Received: by mail-fx0-f46.google.com with SMTP id 8so1231034fxm.19 for ; Tue, 01 Jun 2010 11:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=vwaKiNot+cufGH865U/MnsQ51QZ6VqR7IvynNmtshpU=; b=umBDf7lyOf4r2dCruhgfOB/z1uQ1w23aPVXjLpLnfTFh4YWVc3Y+Y19FkhUYf1ETQA fE0lkrqmQ+JFJGGKaCvy4L1Ti8q+Gs5VmrJ0voQ2tsKRctNbyobQM7TvIhSvFwtYR2gk f/DK916Elj+SaQFZC+Nf8gtBCH3rixS4UTkJA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=LUdBMTiOlOd8uD2DNjem2IIDp7kK7WzKOwQslvdSCfm2I//jyS+lHhXHrKUdMiXK5m 6GOmkx7Zk6CzmFqAeY0/rSI16kx7CUwm9mhUkMhSbUmP1H2FZ6SUuMA2NlJ8TCJsJJ+L SteVpaQg3nq55KvKsd/a5RgV/Bp0W24e7v9bE= Received: by 10.223.6.152 with SMTP id 24mr7517883faz.25.1275416559965; Tue, 01 Jun 2010 11:22:39 -0700 (PDT) Received: from localhost.localdomain ([77.127.199.160]) by mx.google.com with ESMTPS id g10sm48248722fai.0.2010.06.01.11.22.36 (version=SSLv3 cipher=RC4-MD5); Tue, 01 Jun 2010 11:22:37 -0700 (PDT) From: Maxim Levitsky To: "linux-acpi@vger.kernel.org" Cc: linux-pm , Matthew Garrett , "Rafael J. Wysocki" , Alan Stern , Maxim Levitsky Subject: [PATCH 2/2] ACPI: Store NVS state even when entering suspend to RAM Date: Tue, 1 Jun 2010 21:22:24 +0300 Message-Id: <1275416544-4515-2-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1275416390.3778.7.camel@maxim-laptop> References: <1275416390.3778.7.camel@maxim-laptop> 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]); Tue, 01 Jun 2010 18:22:42 +0000 (UTC) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index bdb306f..5d26d8e 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -114,6 +114,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; @@ -143,6 +145,8 @@ static void acpi_pm_finish(void) { u32 acpi_state = acpi_target_sleep_state; + suspend_nvs_free(); + if (acpi_state == ACPI_STATE_S0) return; @@ -192,6 +196,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); @@ -269,6 +278,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; } @@ -443,7 +454,6 @@ static int acpi_hibernation_enter(void) static void acpi_hibernation_finish(void) { - suspend_nvs_free(); acpi_ec_unblock_transactions(); acpi_pm_finish(); } @@ -479,7 +489,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,