[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090827203948.9CD25526EC9@mailhub.coreip.homeip.net>
Date: Thu, 27 Aug 2009 13:07:35 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: linux-pm <linux-pm@...ts.linux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, Len Brown <lenb@...nel.org>,
Pavel Machek <pavel@....cz>,
Alan Stern <stern@...land.harvard.edu>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Arjan van de Ven <arjan@...radead.org>,
Zhang Rui <rui.zhang@...el.com>,
Linux PCI <linux-pci@...r.kernel.org>
Subject: Re: [PATCH 7] PM: Add a switch for disabling/enabling asynchronous
suspend/resume
On Thu, Aug 27, 2009 at 09:19:46PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@...k.pl>
>
> Add sysfs attribute kernel/power/pm_async allowing the user space to
> disable and enable async suspend/resume of devices.
>
> Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
> ---
> drivers/base/power/main.c | 13 +++++++------
> drivers/base/power/power.h | 6 +++---
> kernel/power/main.c | 28 +++++++++++++++++++++++++++-
> 3 files changed, 37 insertions(+), 10 deletions(-)
>
> Index: linux-2.6/kernel/power/main.c
> ===================================================================
> --- linux-2.6.orig/kernel/power/main.c
> +++ linux-2.6/kernel/power/main.c
> @@ -44,6 +44,29 @@ int pm_notifier_call_chain(unsigned long
> == NOTIFY_BAD) ? -EINVAL : 0;
> }
>
> +/* If set, devices may be suspended and resumed asynchronously. */
> +int pm_async_enabled = 1;
> +
> +static ssize_t pm_async_show(struct kobject *kobj, struct kobj_attribute *attr,
> + char *buf)
> +{
> + return sprintf(buf, "%d\n", pm_async_enabled);
> +}
> +
> +static ssize_t pm_async_store(struct kobject *kobj, struct kobj_attribute *attr,
> + const char *buf, size_t n)
> +{
> + int val;
> +
> + if (sscanf(buf, "%d", &val) == 1) {
I prefer more vigorous restrictions on the sysfs interfaces. Maybe:
if (strict_strtoul(buf, 10, &val) || val > 1)
return -EINVAL;
pm_async_enabled = val;
?
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists