* [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format
@ 2012-05-09 10:23 Minho Ban
2012-05-12 21:39 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Minho Ban @ 2012-05-09 10:23 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Len Brown, Pavel Machek, Rob Landley, linux-kernel, linux-doc, linux-pm
Sometimes resume= parameter comes in integer style (e.g. major:minor) 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.
Signed-off-by: Minho Ban <mhban@samsung.com>
---
Documentation/kernel-parameters.txt | 2 ++
kernel/power/hibernate.c | 13 +++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index c1601e5..5900b49 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2372,6 +2372,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
resume= [SWSUSP]
Specify the partition device for software suspend
+ Format:
+ {/dev/<dev> | PARTUUID=<uuid> | <int>:<int> | <hex>}
resume_offset= [SWSUSP]
Specify the offset from the beginning of the partition
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e09dfbf..8b53db3 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"
@@ -722,6 +724,17 @@ static int software_resume(void)
/* Check if the device is there */
swsusp_resume_device = name_to_dev_t(resume_file);
+
+ /*
+ * name_to_dev_t is ineffective to verify parition if resume_file is in
+ * integer format. (e.g. major:minor)
+ */
+ if (isdigit(resume_file[0]) && resume_wait) {
+ int partno;
+ while (!get_gendisk(swsusp_resume_device, &partno))
+ msleep(10);
+ }
+
if (!swsusp_resume_device) {
/*
* Some device discovery might still be in progress; we need
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format
2012-05-09 10:23 [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format Minho Ban
@ 2012-05-12 21:39 ` Rafael J. Wysocki
2012-05-14 0:53 ` Minho Ban
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-05-12 21:39 UTC (permalink / raw)
To: Minho Ban
Cc: Len Brown, Pavel Machek, Rob Landley, linux-kernel, linux-doc, linux-pm
On Wednesday, May 09, 2012, Minho Ban wrote:
> Sometimes resume= parameter comes in integer style (e.g. major:minor) 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.
>
> Signed-off-by: Minho Ban <mhban@samsung.com>
> ---
> Documentation/kernel-parameters.txt | 2 ++
> kernel/power/hibernate.c | 13 +++++++++++++
> 2 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index c1601e5..5900b49 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -2372,6 +2372,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>
> resume= [SWSUSP]
> Specify the partition device for software suspend
> + Format:
> + {/dev/<dev> | PARTUUID=<uuid> | <int>:<int> | <hex>}
>
> resume_offset= [SWSUSP]
> Specify the offset from the beginning of the partition
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index e09dfbf..8b53db3 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"
> @@ -722,6 +724,17 @@ static int software_resume(void)
>
> /* Check if the device is there */
> swsusp_resume_device = name_to_dev_t(resume_file);
> +
> + /*
> + * name_to_dev_t is ineffective to verify parition if resume_file is in
> + * integer format. (e.g. major:minor)
> + */
> + if (isdigit(resume_file[0]) && resume_wait) {
> + int partno;
> + while (!get_gendisk(swsusp_resume_device, &partno))
> + msleep(10);
> + }
Hmm. Wouldn't it be better to do:
if (isdigit(resume_file[0]) && resume_wait) {
int partno;
while (!get_gendisk(swsusp_resume_device, &partno))
msleep(10);
} else {
swsusp_resume_device = name_to_dev_t(resume_file);
}
?
Your new code will overwrite whatever swsusp_resume_device is set to by the
preceding statement anyway.
> +
> if (!swsusp_resume_device) {
> /*
> * Some device discovery might still be in progress; we need
>
Thanks,
Rafael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format
2012-05-12 21:39 ` Rafael J. Wysocki
@ 2012-05-14 0:53 ` Minho Ban
2012-05-14 19:00 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Minho Ban @ 2012-05-14 0:53 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Len Brown, Pavel Machek, Rob Landley, linux-kernel, linux-doc, linux-pm
On 05/13/2012 06:39 AM, Rafael J. Wysocki wrote:
> On Wednesday, May 09, 2012, Minho Ban wrote:
>> /* Check if the device is there */
>> swsusp_resume_device = name_to_dev_t(resume_file);
>> +
>> + /*
>> + * name_to_dev_t is ineffective to verify parition if resume_file is in
>> + * integer format. (e.g. major:minor)
>> + */
>> + if (isdigit(resume_file[0]) && resume_wait) {
>> + int partno;
>> + while (!get_gendisk(swsusp_resume_device, &partno))
>> + msleep(10);
>> + }
>
> Hmm. Wouldn't it be better to do:
>
> if (isdigit(resume_file[0]) && resume_wait) {
> int partno;
> while (!get_gendisk(swsusp_resume_device, &partno))
> msleep(10);
> } else {
> swsusp_resume_device = name_to_dev_t(resume_file);
> }
>
> ?
Do you want name_to_dev_t to be called again? If not, swsusp_resume_device parameter
in get_gendisk can not be used because it is not initialized yet.
>
> Your new code will overwrite whatever swsusp_resume_device is set to by the
> preceding statement anyway.
>
Sorry, I don't understand what will be overwritten by the new code. It would be very
much appreciated if you point it again.
Regards,
Minho Ban
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format
2012-05-14 0:53 ` Minho Ban
@ 2012-05-14 19:00 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-05-14 19:00 UTC (permalink / raw)
To: Minho Ban
Cc: Len Brown, Pavel Machek, Rob Landley, linux-kernel, linux-doc, linux-pm
On Monday, May 14, 2012, Minho Ban wrote:
> On 05/13/2012 06:39 AM, Rafael J. Wysocki wrote:
> > On Wednesday, May 09, 2012, Minho Ban wrote:
> >> /* Check if the device is there */
> >> swsusp_resume_device = name_to_dev_t(resume_file);
> >> +
> >> + /*
> >> + * name_to_dev_t is ineffective to verify parition if resume_file is in
> >> + * integer format. (e.g. major:minor)
> >> + */
> >> + if (isdigit(resume_file[0]) && resume_wait) {
> >> + int partno;
> >> + while (!get_gendisk(swsusp_resume_device, &partno))
> >> + msleep(10);
> >> + }
> >
> > Hmm. Wouldn't it be better to do:
> >
> > if (isdigit(resume_file[0]) && resume_wait) {
> > int partno;
> > while (!get_gendisk(swsusp_resume_device, &partno))
> > msleep(10);
> > } else {
> > swsusp_resume_device = name_to_dev_t(resume_file);
> > }
> >
> > ?
>
> Do you want name_to_dev_t to be called again? If not, swsusp_resume_device parameter
> in get_gendisk can not be used because it is not initialized yet.
Ah, OK, I didn't notice that.
I think I can take the patch for v3.5 as is.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-14 18:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-09 10:23 [PATCH] PM / Hibernate : Use get_gendisk to verify partition if resume_file is integer format Minho Ban
2012-05-12 21:39 ` Rafael J. Wysocki
2012-05-14 0:53 ` Minho Ban
2012-05-14 19:00 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).