[PATCH] swsusp: resume_store() retval fix
- This function returns -EINVAL all the time. Fix. - Decruftify it a bit too. - Writing to it doesn't seem to do what it's suppoed to do. Cc: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
817c41d76e
commit
a576219aca
@@ -365,28 +365,26 @@ static ssize_t resume_show(struct subsystem * subsys, char *buf)
|
|||||||
|
|
||||||
static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n)
|
static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
char *p;
|
|
||||||
unsigned int maj, min;
|
unsigned int maj, min;
|
||||||
int error = -EINVAL;
|
|
||||||
dev_t res;
|
dev_t res;
|
||||||
|
int ret = -EINVAL;
|
||||||
|
|
||||||
p = memchr(buf, '\n', n);
|
if (sscanf(buf, "%u:%u", &maj, &min) != 2)
|
||||||
len = p ? p - buf : n;
|
goto out;
|
||||||
|
|
||||||
if (sscanf(buf, "%u:%u", &maj, &min) == 2) {
|
|
||||||
res = MKDEV(maj,min);
|
res = MKDEV(maj,min);
|
||||||
if (maj == MAJOR(res) && min == MINOR(res)) {
|
if (maj != MAJOR(res) || min != MINOR(res))
|
||||||
|
goto out;
|
||||||
|
|
||||||
down(&pm_sem);
|
down(&pm_sem);
|
||||||
swsusp_resume_device = res;
|
swsusp_resume_device = res;
|
||||||
up(&pm_sem);
|
up(&pm_sem);
|
||||||
printk("Attempting manual resume\n");
|
printk("Attempting manual resume\n");
|
||||||
noresume = 0;
|
noresume = 0;
|
||||||
software_resume();
|
software_resume();
|
||||||
}
|
ret = n;
|
||||||
}
|
out:
|
||||||
|
return ret;
|
||||||
return error >= 0 ? n : error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
power_attr(resume);
|
power_attr(resume);
|
||||||
|
Reference in New Issue
Block a user