From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] PM: convert PM notifiers to out-of-line code
Date: Mon, 5 Nov 2007 23:01:29 +0100 [thread overview]
Message-ID: <200711052301.30112.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0711051556210.2800-100000@iolanthe.rowland.org>
On Monday, 5 of November 2007, Alan Stern wrote:
> This patch (as1008) 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>
I'd prefer to define the routines in main.c, because I really don't consider
them as being strictly related to the freezing of processes.
Greetings,
Rafael
> ---
>
> Index: usb-2.6/include/linux/suspend.h
> ===================================================================
> --- usb-2.6.orig/include/linux/suspend.h
> +++ usb-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: usb-2.6/kernel/power/main.c
> ===================================================================
> --- usb-2.6.orig/kernel/power/main.c
> +++ usb-2.6/kernel/power/main.c
> @@ -24,8 +24,6 @@
>
> #include "power.h"
>
> -BLOCKING_NOTIFIER_HEAD(pm_chain_head);
> -
> DEFINE_MUTEX(pm_mutex);
>
> #ifdef CONFIG_SUSPEND
> Index: usb-2.6/kernel/power/power.h
> ===================================================================
> --- usb-2.6.orig/kernel/power/power.h
> +++ usb-2.6/kernel/power/power.h
> @@ -203,11 +203,5 @@ 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;
> -}
> +/* kernel/power/process.c */
> +extern int pm_notifier_call_chain(unsigned long val);
> Index: usb-2.6/kernel/power/process.c
> ===================================================================
> --- usb-2.6.orig/kernel/power/process.c
> +++ usb-2.6/kernel/power/process.c
> @@ -283,3 +283,25 @@ void thaw_processes(void)
> }
>
> EXPORT_SYMBOL(refrigerator);
> +
> +/* 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;
> +}
next prev parent reply other threads:[~2007-11-05 22:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-05 20:58 [PATCH] PM: convert PM notifiers to out-of-line code Alan Stern
2007-11-05 22:01 ` Rafael J. Wysocki [this message]
2007-11-06 16:37 ` Alan Stern
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=200711052301.30112.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-pm@lists.linux-foundation.org \
--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