[RFC/PATCH] PM / Hibernate : Add wait for disk detection ifresume_file is MAJOR:MINOR style

From: Minho Ban
Date: Mon May 07 2012 - 04:26:12 EST


name_to_dev_t is not enough to check device detection when the resume_file is
MAJOR:MINOR format. get_gendisk is needed in that case.

Signed-off-by: Minho Ban <mhban@xxxxxxxxxxx>
---
kernel/power/hibernate.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e09dfbf..27efaef 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -25,6 +25,8 @@
#include <linux/freezer.h>
#include <linux/gfp.h>
#include <linux/syscore_ops.h>
+#include <linux/ctype.h>
+#include <linux/genhd.h>
#include <scsi/scsi_scan.h>

#include "power.h"
@@ -749,6 +751,14 @@ static int software_resume(void)
}
}

+ /* name_to_dev_t is ineffective if resume_file comes in major:minor
+ * format */
+ if (isdigit(resume_file[0]) && resume_wait) {
+ int partno;
+ while (!get_gendisk(swsusp_resume_device, &partno))
+ msleep(10);
+ }
+
Check_image:
pr_debug("PM: Hibernation image partition %d:%d present\n",
MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/