diff options
-rw-r--r-- | kernel/power/disk.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 027322a564f4..4d944b281b28 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -363,30 +363,28 @@ static ssize_t resume_show(struct subsystem * subsys, char *buf) | |||
363 | MINOR(swsusp_resume_device)); | 363 | MINOR(swsusp_resume_device)); |
364 | } | 364 | } |
365 | 365 | ||
366 | static ssize_t resume_store(struct subsystem * subsys, const char * buf, size_t n) | 366 | static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n) |
367 | { | 367 | { |
368 | int len; | ||
369 | char *p; | ||
370 | unsigned int maj, min; | 368 | unsigned int maj, min; |
371 | int error = -EINVAL; | ||
372 | dev_t res; | 369 | dev_t res; |
370 | int ret = -EINVAL; | ||
373 | 371 | ||
374 | p = memchr(buf, '\n', n); | 372 | if (sscanf(buf, "%u:%u", &maj, &min) != 2) |
375 | len = p ? p - buf : n; | 373 | goto out; |
376 | 374 | ||
377 | if (sscanf(buf, "%u:%u", &maj, &min) == 2) { | 375 | res = MKDEV(maj,min); |
378 | res = MKDEV(maj,min); | 376 | if (maj != MAJOR(res) || min != MINOR(res)) |
379 | if (maj == MAJOR(res) && min == MINOR(res)) { | 377 | goto out; |
380 | down(&pm_sem); | ||
381 | swsusp_resume_device = res; | ||
382 | up(&pm_sem); | ||
383 | printk("Attempting manual resume\n"); | ||
384 | noresume = 0; | ||
385 | software_resume(); | ||
386 | } | ||
387 | } | ||
388 | 378 | ||
389 | return error >= 0 ? n : error; | 379 | down(&pm_sem); |
380 | swsusp_resume_device = res; | ||
381 | up(&pm_sem); | ||
382 | printk("Attempting manual resume\n"); | ||
383 | noresume = 0; | ||
384 | software_resume(); | ||
385 | ret = n; | ||
386 | out: | ||
387 | return ret; | ||
390 | } | 388 | } |
391 | 389 | ||
392 | power_attr(resume); | 390 | power_attr(resume); |