Re: [PATCH -mm] PM: Separate hibernation code from suspend code



On Saturday, 5 May 2007 14:27, Johannes Berg wrote:
On Sat, 2007-05-05 at 14:21 +0200, Rafael J. Wysocki wrote:

Power off the system instead of halting it if the 'platform' mode of
hibernation
has been requested, but hibernation_ops is not set.

Ehm, unless you made a mistake in the patch then that shouldn't be
possible.

Hmm, right, but the patch is correct nevertheless. :-)

I see where the problem is. hibernation_mode is 0 by default
(HIBERNATION_INVALID) and it's not changed to anything else later if
defaults are used.

Something like this is necessary, I think:

---
From: Rafael J. Wysocki <rjw@xxxxxxx>

Make sure that hibernation_mode is set to a reasonable value by default.

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
---
kernel/power/disk.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6.21/kernel/power/disk.c
===================================================================
--- linux-2.6.21.orig/kernel/power/disk.c 2007-05-05 13:51:45.000000000 +0200
+++ linux-2.6.21/kernel/power/disk.c 2007-05-05 15:45:23.000000000 +0200
@@ -30,8 +30,6 @@ char resume_file[256] = CONFIG_PM_STD_PA
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;

-static int hibernation_mode;
-
enum {
HIBERNATION_INVALID,
HIBERNATION_PLATFORM,
@@ -45,6 +43,8 @@ enum {
#define HIBERNATION_MAX (__HIBERNATION_AFTER_LAST-1)
#define HIBERNATION_FIRST (HIBERNATION_INVALID + 1)

+static int hibernation_mode = HIBERNATION_SHUTDOWN;
+
struct hibernation_ops *hibernation_ops;

/**
@@ -60,6 +60,9 @@ void hibernation_set_ops(struct hibernat
}
mutex_lock(&pm_mutex);
hibernation_ops = ops;
+ if (ops)
+ hibernation_mode = HIBERNATION_PLATFORM;
+
mutex_unlock(&pm_mutex);
}

-
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/



Relevant Pages

  • Re: [PATCH -mm] PM: Separate hibernation code from suspend code
    ... Power off the system instead of halting it if the 'platform' mode of ... Ehm, unless you made a mistake in the patch then that shouldn't be ...
    (Linux-Kernel)
  • Re: [PATCH] ne.c fix for hibernate and rmmod oops fix
    ... Notable changes since the last patch: ... code doesn't even need the resources passed by the platform device. ... The ne.c driver already registers the resources it needs and there ... Note the user space ISA PnP doesn't work for suspend to disk, ...
    (Linux-Kernel)
  • Re: [RFC, Announce] Unified x86 architecture, arch/x86
    ... have a nice style that you like and think that it is cleaner. ... It's not really the same platform: one is PC hardware going back forever ... with zillions of bugs, the other is modern PC platforms which much less ... That was not the point of this patch. ...
    (Linux-Kernel)
  • Re: Linux UIO driver cache problem in PowerPC (fix)
    ... I investigated a bit and found your patch to be correct. ... registers mapped on my platform using the user-space mmapcall. ... I'm not sure whether this is a bug in PPC memory handling. ... This patch is against your initial commit of the UIO driver in the ...
    (Linux-Kernel)
  • Re: [PATCH] swsusp: Use platform mode by default
    ... With this patch, my desktop no longer powers off after hibernate. ... The change to using the 'platform' mode by default was made because some ... notebooks didn't suspend and resume correctly in the 'shutdown' mode. ...
    (Linux-Kernel)