Skip to content

Commit 2df83fa

Browse files
puffminerjwysocki
authored andcommitted
PM / Hibernate: Use get_gendisk to verify partition if resume_file is integer format
Sometimes resume= parameter comes in integer style (e.g. major:minor) and then name_to_dev_t can not detect partition properly. (especially async device like usb, mmc). This patch calls get_gendisk() if resumewait is true and resume_file is in integer format to work around this problem. Signed-off-by: Minho Ban <mhban@samsung.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
1 parent 4e585d2 commit 2df83fa

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎Documentation/kernel-parameters.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,6 +2372,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
23722372

23732373
resume= [SWSUSP]
23742374
Specify the partition device for software suspend
2375+
Format:
2376+
{/dev/<dev> | PARTUUID=<uuid> | <int>:<int> | <hex>}
23752377

23762378
resume_offset= [SWSUSP]
23772379
Specify the offset from the beginning of the partition

‎kernel/power/hibernate.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <linux/freezer.h>
2626
#include <linux/gfp.h>
2727
#include <linux/syscore_ops.h>
28+
#include <linux/ctype.h>
29+
#include <linux/genhd.h>
2830
#include <scsi/scsi_scan.h>
2931

3032
#include "power.h"
@@ -722,6 +724,17 @@ static int software_resume(void)
722724

723725
/* Check if the device is there */
724726
swsusp_resume_device = name_to_dev_t(resume_file);
727+
728+
/*
729+
* name_to_dev_t is ineffective to verify parition if resume_file is in
730+
* integer format. (e.g. major:minor)
731+
*/
732+
if (isdigit(resume_file[0]) && resume_wait) {
733+
int partno;
734+
while (!get_gendisk(swsusp_resume_device, &partno))
735+
msleep(10);
736+
}
737+
725738
if (!swsusp_resume_device) {
726739
/*
727740
* Some device discovery might still be in progress; we need

0 commit comments

Comments
 (0)