Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a576219a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds
Browse files

[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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 817c41d7
Loading
Loading
Loading
Loading
+16 −18
Original line number Original line Diff line number Diff line
@@ -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);