From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Johannes Berg <johannes@sipsolutions.net>, Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH v4] pm_ops: add system quiesce/activate hooks
Date: Fri, 13 Apr 2007 22:43:59 +0200 [thread overview]
Message-ID: <200704132243.59618.rjw@sisk.pl> (raw)
In-Reply-To: <1176470819.7052.108.camel@johannes.berg>
On Friday, 13 April 2007 15:26, Johannes Berg wrote:
> For powermac, we need to do some things between suspending devices and
> device_power_off, for example setting the decrementer. This patch
> introduces pm_ops.quiesce and pm_ops.activate which will be called instead
> of disabling/enabling irqs so platforms get control over this step.
>
> If not assigned, these two calls will be assigned with defaults during
> set_pm_ops.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
I have no objections. Pavel, what do you think?
Rafael
> ---
> include/linux/pm.h | 12 ++++++++++++
> kernel/power/main.c | 35 ++++++++++++++++++++++++++++++++---
> 2 files changed, 44 insertions(+), 3 deletions(-)
>
> --- wireless-dev.orig/include/linux/pm.h 2007-04-13 10:09:17.835356880 +0200
> +++ wireless-dev/include/linux/pm.h 2007-04-13 14:57:01.525356880 +0200
> @@ -135,9 +135,19 @@ typedef int __bitwise suspend_disk_metho
> * @prepare: Prepare the platform for the given suspend state. Can return a
> * negative error code if necessary.
> *
> + * @quiesce: This callback is called after devices are suspended but before
> + * they are powered down. If assigned, this callback must at least turn
> + * off local IRQs. If left unassigned, a default callback that does
> + * nothing but turn off local IRQs is assigned during pm_set_ops().
> + *
> * @enter: Enter the given suspend state, must be assigned. Can return a
> * negative error code if necessary.
> *
> + * @activate: This callback is called after devices are powered up but
> + * before they resume. If assigned, this callback must at least turn
> + * on local IRQs. If left unassigned, a default callback that does
> + * nothing but turn on local IRQs is assigned during pm_set_ops().
> + *
> * @finish: Called when the system has left the given state and all devices
> * are resumed. The return value is ignored.
> *
> @@ -155,7 +165,9 @@ typedef int __bitwise suspend_disk_metho
> struct pm_ops {
> int (*valid)(suspend_state_t state);
> int (*prepare)(suspend_state_t state);
> + void (*quiesce)(suspend_state_t state);
> int (*enter)(suspend_state_t state);
> + void (*activate)(suspend_state_t state);
> int (*finish)(suspend_state_t state);
> suspend_disk_method_t pm_disk_mode;
> };
> --- wireless-dev.orig/kernel/power/main.c 2007-04-13 10:09:17.835356880 +0200
> +++ wireless-dev/kernel/power/main.c 2007-04-13 14:53:44.975356880 +0200
> @@ -33,6 +33,28 @@ struct pm_ops *pm_ops;
> suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
>
> /**
> + * pm_default_quiesce - default quiesce callback
> + *
> + * pm_ops drivers that need to do nothing but disable IRQs
> + * leave .quiesce unassigned and pm_set_ops() assigns this.
> + */
> +static void pm_default_quiesce(suspend_state_t state)
> +{
> + local_irq_disable();
> +}
> +
> +/**
> + * pm_default_activate - default activate callback
> + *
> + * pm_ops drivers that need to do nothing but enable IRQs
> + * leave .activate unassigned and pm_set_ops assigns this.
> + */
> +static void pm_default_activate(suspend_state_t state)
> +{
> + local_irq_enable();
> +}
> +
> +/**
> * pm_set_ops - Set the global power method table.
> * @ops: Pointer to ops structure.
> */
> @@ -45,6 +67,12 @@ void pm_set_ops(struct pm_ops * ops)
> pm_disk_mode = ops->pm_disk_mode;
> } else
> pm_disk_mode = PM_DISK_SHUTDOWN;
> +
> + if (!ops->quiesce)
> + ops->quiesce = pm_default_quiesce;
> + if (!ops->activate)
> + ops->activate = pm_default_activate;
> +
> mutex_unlock(&pm_mutex);
> }
>
> @@ -132,9 +160,9 @@ static int suspend_prepare(suspend_state
> int suspend_enter(suspend_state_t state)
> {
> int error = 0;
> - unsigned long flags;
>
> - local_irq_save(flags);
> + pm_ops->quiesce(state);
> + BUG_ON(!irqs_disabled());
>
> if ((error = device_power_down(PMSG_SUSPEND))) {
> printk(KERN_ERR "Some devices failed to power down\n");
> @@ -143,7 +171,8 @@ int suspend_enter(suspend_state_t state)
> error = pm_ops->enter(state);
> device_power_up();
> Done:
> - local_irq_restore(flags);
> + pm_ops->activate(state);
> + BUG_ON(irqs_disabled());
> return error;
> }
next prev parent reply other threads:[~2007-04-13 20:43 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-05 21:54 [PATCH] pm_ops: add irq enable/disable hooks Johannes Berg
2007-04-05 23:30 ` Rafael J. Wysocki
2007-04-05 23:28 ` Johannes Berg
2007-04-06 0:02 ` Rafael J. Wysocki
2007-04-06 0:09 ` Johannes Berg
2007-04-06 0:17 ` Rafael J. Wysocki
2007-04-06 8:48 ` Johannes Berg
2007-04-06 9:41 ` Rafael J. Wysocki
2007-04-06 9:44 ` Johannes Berg
2007-04-06 10:02 ` Rafael J. Wysocki
2007-04-06 10:00 ` Johannes Berg
2007-04-06 19:19 ` Pavel Machek
2007-04-06 21:59 ` Johannes Berg
2007-04-10 11:36 ` Pavel Machek
2007-04-10 11:45 ` Johannes Berg
2007-04-10 12:00 ` Pavel Machek
2007-04-10 13:42 ` Johannes Berg
2007-04-11 11:22 ` Benjamin Herrenschmidt
2007-04-11 14:07 ` Alan Stern
2007-04-11 16:39 ` Johannes Berg
2007-04-11 21:40 ` Benjamin Herrenschmidt
2007-04-11 11:15 ` Johannes Berg
2007-04-06 19:16 ` Pavel Machek
2007-04-11 15:54 ` [PATCH v2] pm_ops: add system quiesce/activate hooks Johannes Berg
2007-04-11 20:47 ` Dmitry Krivoschekov
2007-04-12 8:39 ` Johannes Berg
2007-04-12 8:42 ` Benjamin Herrenschmidt
2007-04-12 10:16 ` Pavel Machek
2007-04-12 10:45 ` Rafael J. Wysocki
2007-04-12 10:47 ` Johannes Berg
2007-04-13 21:00 ` Pavel Machek
2007-04-13 21:11 ` Johannes Berg
2007-04-13 21:43 ` Pavel Machek
2007-04-13 21:11 ` Paul Mackerras
2007-04-13 21:15 ` Benjamin Herrenschmidt
2007-04-12 11:23 ` Benjamin Herrenschmidt
2007-04-12 15:03 ` Rafael J. Wysocki
2007-04-12 16:32 ` David Brownell
2007-04-13 6:52 ` Johannes Berg
2007-04-13 7:59 ` [PATCH v3] " Johannes Berg
2007-04-12 17:36 ` [PATCH v2] " Dmitry Krivoschekov
2007-04-12 20:51 ` Benjamin Herrenschmidt
2007-04-13 6:54 ` Johannes Berg
2007-04-13 8:04 ` David Brownell
2007-04-13 8:59 ` Johannes Berg
2007-04-13 9:07 ` Benjamin Herrenschmidt
2007-04-13 11:47 ` Rafael J. Wysocki
2007-04-13 12:58 ` Johannes Berg
2007-04-13 13:26 ` [PATCH v4] " Johannes Berg
2007-04-13 20:43 ` Rafael J. Wysocki [this message]
2007-04-13 20:58 ` Pavel Machek
2007-04-13 21:06 ` Johannes Berg
2007-04-13 21:12 ` Pavel Machek
2007-04-13 21:18 ` Johannes Berg
2007-04-13 21:33 ` Pavel Machek
2007-04-13 21:45 ` Johannes Berg
2007-04-13 21:52 ` Pavel Machek
2007-04-13 21:59 ` Johannes Berg
2007-04-13 22:18 ` Rafael J. Wysocki
2007-04-13 22:20 ` Johannes Berg
2007-04-13 22:49 ` Rafael J. Wysocki
2007-04-13 22:55 ` Johannes Berg
2007-04-13 22:09 ` Rafael J. Wysocki
2007-04-13 22:13 ` Johannes Berg
2007-04-13 22:16 ` Pavel Machek
2007-04-14 16:55 ` Paul Mackerras
2007-04-13 22:25 ` Benjamin Herrenschmidt
2007-04-13 22:39 ` Pavel Machek
2007-04-13 23:19 ` Benjamin Herrenschmidt
2007-04-14 9:14 ` Rafael J. Wysocki
2007-04-14 9:19 ` Johannes Berg
2007-04-15 0:19 ` Benjamin Herrenschmidt
2007-04-16 7:32 ` Pavel Machek
2007-04-16 8:37 ` Johannes Berg
2007-04-16 12:47 ` Pavel Machek
2007-04-17 4:58 ` Paul Mackerras
2007-04-18 7:50 ` Benjamin Herrenschmidt
2007-04-13 22:47 ` Rafael J. Wysocki
2007-04-13 21:18 ` Benjamin Herrenschmidt
2007-04-13 21:56 ` Pavel Machek
2007-04-13 22:01 ` Johannes Berg
2007-04-13 22:24 ` Benjamin Herrenschmidt
2007-04-13 21:15 ` Benjamin Herrenschmidt
2007-04-13 21:50 ` Pavel Machek
2007-04-13 22:23 ` Benjamin Herrenschmidt
2007-04-14 22:10 ` David Brownell
2007-04-13 21:05 ` [PATCH v2] " Pavel Machek
2007-04-12 8:44 ` Benjamin Herrenschmidt
2007-04-17 17:18 ` [PATCH] s2ram: add arch irq disable/enable hooks Johannes Berg
2007-04-18 11:27 ` Pavel Machek
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=200704132243.59618.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=johannes@sipsolutions.net \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@ucw.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.