Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20022
b: refs/heads/master
c: 022f7b0
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Machek authored and Greg Kroah-Hartman committed Feb 6, 2006
1 parent 44133ad commit eb882a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68f5f996347dc2724a0dd511683643a2b6912380
refs/heads/master: 022f7b07bf2b384ece7fbd7edb90e54cd78db252
24 changes: 16 additions & 8 deletions trunk/drivers/base/power/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,30 @@

static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
{
return sprintf(buf, "%u\n", dev->power.power_state.event);
if (dev->power.power_state.event)
return sprintf(buf, "2\n");
else
return sprintf(buf, "0\n");
}

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;
/* Older apps expected to write "3" here - confused with PCI D3 */
if ((n == 1) && !strcmp(buf, "3"))
error = dpm_runtime_suspend(dev, state);
else

if ((n == 1) && !strcmp(buf, "2"))
error = dpm_runtime_suspend(dev, state);

if ((n == 1) && !strcmp(buf, "0")) {
dpm_runtime_resume(dev);
error = 0;
}

return error ? error : n;
}

Expand Down

0 comments on commit eb882a0

Please sign in to comment.