From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Len Brown <lenb@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Pavel Machek <pavel@ucw.cz>,
Johannes Berg <johannes@sipsolutions.net>,
pm list <linux-pm@lists.linux-foundation.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Adrian Bunk <bunk@kernel.org>
Subject: [PATCH 8/8] PM: Convert PM notifiers to out-of-line code
Date: Mon, 19 Nov 2007 23:49:18 +0100 [thread overview]
Message-ID: <200711192349.19063.rjw@sisk.pl> (raw)
In-Reply-To: <200711192332.15078.rjw@sisk.pl>
From: Alan Stern <stern@rowland.harvard.edu>
This patch (as1008b) converts the PM notifier routines from inline
calls to out-of-line code. It also prevents pm_chain_head from
being created when CONFIG_PM_SLEEP isn't enabled, and EXPORTs the
notifier registration and unregistration routines.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
include/linux/suspend.h | 13 ++-----------
kernel/power/main.c | 28 ++++++++++++++++++++++++++--
kernel/power/power.h | 12 ++++--------
3 files changed, 32 insertions(+), 21 deletions(-)
Index: linux-2.6/include/linux/suspend.h
===================================================================
--- linux-2.6.orig/include/linux/suspend.h
+++ linux-2.6/include/linux/suspend.h
@@ -216,17 +216,8 @@ void __save_processor_state(struct saved
void __restore_processor_state(struct saved_context *ctxt);
/* kernel/power/main.c */
-extern struct blocking_notifier_head pm_chain_head;
-
-static inline int register_pm_notifier(struct notifier_block *nb)
-{
- return blocking_notifier_chain_register(&pm_chain_head, nb);
-}
-
-static inline int unregister_pm_notifier(struct notifier_block *nb)
-{
- return blocking_notifier_chain_unregister(&pm_chain_head, nb);
-}
+extern int register_pm_notifier(struct notifier_block *nb);
+extern int unregister_pm_notifier(struct notifier_block *nb);
#define pm_notifier(fn, pri) { \
static struct notifier_block fn##_nb = \
Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c
+++ linux-2.6/kernel/power/main.c
@@ -24,10 +24,34 @@
#include "power.h"
-BLOCKING_NOTIFIER_HEAD(pm_chain_head);
-
DEFINE_MUTEX(pm_mutex);
+#ifdef CONFIG_PM_SLEEP
+
+/* Routines for PM-transition notifications */
+
+static BLOCKING_NOTIFIER_HEAD(pm_chain_head);
+
+int register_pm_notifier(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_register(&pm_chain_head, nb);
+}
+EXPORT_SYMBOL_GPL(register_pm_notifier);
+
+int unregister_pm_notifier(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&pm_chain_head, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_pm_notifier);
+
+int pm_notifier_call_chain(unsigned long val)
+{
+ return (blocking_notifier_call_chain(&pm_chain_head, val, NULL)
+ == NOTIFY_BAD) ? -EINVAL : 0;
+}
+
+#endif /* CONFIG_PM_SLEEP */
+
#ifdef CONFIG_PM_DEBUG
int pm_test_level = TEST_NONE;
Index: linux-2.6/kernel/power/power.h
===================================================================
--- linux-2.6.orig/kernel/power/power.h
+++ linux-2.6/kernel/power/power.h
@@ -174,14 +174,10 @@ static inline int suspend_devices_and_en
}
#endif /* !CONFIG_SUSPEND */
-/* kernel/power/common.c */
-extern struct blocking_notifier_head pm_chain_head;
-
-static inline int pm_notifier_call_chain(unsigned long val)
-{
- return (blocking_notifier_call_chain(&pm_chain_head, val, NULL)
- == NOTIFY_BAD) ? -EINVAL : 0;
-}
+#ifdef CONFIG_PM_SLEEP
+/* kernel/power/main.c */
+extern int pm_notifier_call_chain(unsigned long val);
+#endif
#ifdef CONFIG_HIGHMEM
unsigned int count_highmem_pages(void);
next prev parent reply other threads:[~2007-11-19 22:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 22:32 [PATCH 0/8] Suspend/hibernation patches for 2.6.25 Rafael J. Wysocki
2007-11-19 22:33 ` [PATCH 1/8] ACPI: Fix mismerge in acpi_hibernation_finish Rafael J. Wysocki
2007-11-19 22:36 ` [PATCH 2/8] Hibernation: Move function prototypes to header Rafael J. Wysocki
2007-11-19 22:38 ` [PATCH 3/8] Hibernation: Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers (rev. 2) Rafael J. Wysocki
2007-11-19 22:41 ` [PATCH 4/8] Suspend: Testing facility " Rafael J. Wysocki
2007-11-19 22:42 ` [PATCH 5/8] Hibernation: New testing " Rafael J. Wysocki
2007-11-19 22:43 ` [PATCH 6/8] PM: Suspend/hibernation debug documentation update " Rafael J. Wysocki
2007-11-19 22:46 ` [PATCH 7/8] PM: Make PM_TRACE more architecture independent Rafael J. Wysocki
2007-11-19 22:49 ` Rafael J. Wysocki [this message]
2007-11-20 6:41 ` [PATCH 0/8] Suspend/hibernation patches for 2.6.25 Len Brown
2007-11-20 23:59 ` Rafael J. Wysocki
2007-11-21 1:13 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200711192349.19063.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=bunk@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@ucw.cz \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox