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.
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -25,6 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <linux/freezer.h> |
| 26 | 26 | #include <linux/gfp.h> |
| 27 | 27 | #include <linux/syscore_ops.h> |
| 28 | +#include <linux/ctype.h> | |
| 29 | +#include <linux/genhd.h> | |
| 28 | 30 | #include <scsi/scsi_scan.h> |
| 29 | 31 | |
| 30 | 32 | #include "power.h" |
| @@ -722,6 +724,17 @@ static int software_resume(void) · 691 unmodified lines | ||
| 722 | 724 | |
| 723 | 725 | /* Check if the device is there */ |
| 724 | 726 | 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 | + | |
| 725 | 738 | if (!swsusp_resume_device) { |
| 726 | 739 | /* |
| 727 | 740 | * Some device discovery might still be in progress; we need |