From patchwork Fri Mar 18 17:46:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 644591 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2IIGcJZ009337 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 18 Mar 2011 18:17:36 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2IHmcVo000495; Fri, 18 Mar 2011 10:49:05 -0700 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2IHkOUU032740 for ; Fri, 18 Mar 2011 10:46:29 -0700 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110318174623.ZUOK13167.mtaout03-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Fri, 18 Mar 2011 17:46:23 +0000 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110318174623.BCQD25842.aamtaout02-winn.ispmail.ntl.com@zog.reactivated.net>; Fri, 18 Mar 2011 17:46:23 +0000 Received: by zog.reactivated.net (Postfix, from userid 1000) id 2D0B99D401D; Fri, 18 Mar 2011 17:46:20 +0000 (GMT) From: Daniel Drake To: len.brown@intel.com To: pavel@ucw.cz To: rjw@sisk.pl Message-Id: <20110318174620.2D0B99D401D@zog.reactivated.net> Date: Fri, 18 Mar 2011 17:46:20 +0000 (GMT) X-Cloudmark-Analysis: v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=NEBlUcsP8BsA:10 a=Op-mwl0xAAAA:8 a=E3Wg56Yv6vMVsIO8lX8A:9 a=3rvsOzKZCcPlNAOfFTkA:7 a=XyOJE69Y68TbAitWfK9-qP3mAy4A:4 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-6.381 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: linux-pm@lists.linux-foundation.org, dilinger@queued.net Subject: [linux-pm] [PATCH] PM / Suspend: Add more suspend notifier events X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Mar 2011 18:17:36 +0000 (UTC) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 2026f9e..4519d4f 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -254,10 +254,12 @@ static inline int notifier_to_errno(int ret) /* Hibernation and suspend events */ #define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ #define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */ -#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ -#define PM_POST_SUSPEND 0x0004 /* Suspend finished */ -#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ -#define PM_POST_RESTORE 0x0006 /* Restore failed */ +#define PM_SUSPEND_PREPARE 0x0003 /* Preparing to suspend the system */ +#define PM_DO_SUSPEND 0x0004 /* Going to suspend the system */ +#define PM_DO_RESUME 0x0005 /* Going to resume the system */ +#define PM_POST_SUSPEND 0x0006 /* Suspend finished */ +#define PM_RESTORE_PREPARE 0x0007 /* Going to restore a saved image */ +#define PM_POST_RESTORE 0x0008 /* Restore failed */ /* Console keyboard events. * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 2814c32..35acfc5 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -224,9 +224,14 @@ int suspend_devices_and_enter(suspend_state_t state) if (suspend_test(TEST_DEVICES)) goto Recover_platform; + error = pm_notifier_call_chain(PM_DO_SUSPEND); + if (error) + goto Recover_platform; + suspend_enter(state); Resume_devices: + pm_notifier_call_chain(PM_DO_RESUME); suspend_test_start(); dpm_resume_end(PMSG_RESUME); suspend_test_finish("resume devices");