From: Pavel Machek <pavel@ucw.cz>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@lists.osdl.org
Subject: Re: Runtime device power management in userspace
Date: Tue, 27 Dec 2005 18:29:50 +0100 [thread overview]
Message-ID: <20051227172950.GH1822@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0512261744260.10595-100000@netrider.rowland.org>
[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]
On Po 26-12-05 17:47:23, Alan Stern wrote:
> On Mon, 26 Dec 2005, Patrick Mochel wrote:
> > To that effect, the per-device power file and its semantics should go away
> > completely and replaced with something that supports this new API.
>
> Allow me to direct your attention to this posting:
>
> http://lists.osdl.org/pipermail/linux-pm/2005-September/001421.html
>
> and the follow-on messages. They implement exactly the type of API you're
> talking about. When I have some time available I will rework the patches,
> with improvements as suggested by the discussions on the mailing list, and
> submit them.
Ok, what about this as a first step? It unbreaks the interface between
kernel and user, and allows something like patches above to be taken
in future, without userland changes.
Pavel
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -33,15 +33,12 @@ static ssize_t state_show(struct device
static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
{
pm_message_t state;
- char * rest;
- int error = 0;
+ int error = -EINVAL;
- state.event = simple_strtoul(buf, &rest, 10);
- if (*rest)
- return -EINVAL;
- if (state.event)
+ state.event = PM_EVENT_SUSPEND;
+ if ((n == 2) && !strncmp(buf, "on", min(n, 2)))
error = dpm_runtime_suspend(dev, state);
- else
+ if ((n == 7) && !strncmp(buf, "suspend", min(n, 7)))
dpm_runtime_resume(dev);
return error ? error : n;
}
--
Thanks, Sharp!
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2005-12-27 17:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-23 14:30 Runtime device power management in userspace Holger Macht
2005-12-23 15:12 ` Patrick Mochel
2005-12-24 0:40 ` Pavel Machek
2005-12-26 20:43 ` Patrick Mochel
2005-12-26 22:33 ` Pavel Machek
2005-12-27 18:59 ` Patrick Mochel
2005-12-27 19:22 ` Pavel Machek
2005-12-27 19:29 ` Patrick Mochel
2005-12-27 19:41 ` Pavel Machek
2005-12-27 20:40 ` Patrick Mochel
2005-12-27 21:06 ` Pavel Machek
2005-12-26 22:47 ` Alan Stern
2005-12-27 17:29 ` Pavel Machek [this message]
2005-12-27 17:36 ` Randy.Dunlap
2005-12-24 15:31 ` Holger Macht
2005-12-26 20:58 ` Patrick Mochel
2005-12-27 20:04 ` Pavel Machek
2005-12-27 20:54 ` Patrick Mochel
2005-12-23 15:17 ` Alan Stern
2005-12-24 0:41 ` Pavel Machek
2005-12-24 0:43 ` 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=20051227172950.GH1822@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-pm@lists.osdl.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