public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?)
       [not found]   ` <alpine.LFD.0.999.0707281130110.3442@woody.linux-foundation.org>
@ 2007-07-29 10:20     ` Rafael J. Wysocki
       [not found]     ` <200707291220.14880.rjw@sisk.pl>
  1 sibling, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 10:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

On Saturday, 28 July 2007 20:31, Linus Torvalds wrote:
> 
> On Sat, 28 Jul 2007, Rafael J. Wysocki wrote:
> > 
> > OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require
> > quite a bit of (compilation) testing on different architectures.
> 
> Sure. I'm not too worried, the fallout should be of the trivial kind. 
>
> Also, mind basing it on the (independent) cleanups that Adrian already 
> sent out. This is all intertwined..

OK, it took more time than I had hoped, but I wanted CONFIG_HIBERNATION and
CONFIG_SUSPEND to be really independent of each other.

The two patches in the next messages implement the idea:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary,
  and make it possible to choose suspend and hibernation independently of each
  other.

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
       [not found]     ` <200707291220.14880.rjw@sisk.pl>
@ 2007-07-29 10:21       ` Rafael J. Wysocki
  2007-07-29 12:38       ` [PATCH 2/2] Introduce CONFIG_SUSPEND Rafael J. Wysocki
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 10:21 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid confusion
(among other things, with CONFIG_SUSPEND introduced in the next patch).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/i386/Kconfig.debug                 |    4 ++--
 arch/i386/kernel/e820.c                 |    2 +-
 arch/i386/mm/init.c                     |    2 +-
 arch/i386/power/Makefile                |    2 +-
 arch/powerpc/Kconfig.debug              |    2 +-
 arch/powerpc/configs/lite5200_defconfig |    2 +-
 arch/powerpc/configs/pmac32_defconfig   |    2 +-
 arch/powerpc/kernel/Makefile            |    6 +++---
 arch/ppc/configs/TQM8540_defconfig      |    2 +-
 arch/ppc/configs/TQM8541_defconfig      |    2 +-
 arch/ppc/configs/TQM8555_defconfig      |    2 +-
 arch/ppc/configs/TQM8560_defconfig      |    2 +-
 arch/ppc/configs/ev64360_defconfig      |    2 +-
 arch/ppc/configs/ml300_defconfig        |    2 +-
 arch/ppc/configs/ml403_defconfig        |    2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |    2 +-
 arch/ppc/configs/prep_defconfig         |    2 +-
 arch/sparc64/Kconfig.debug              |    2 +-
 arch/x86_64/defconfig                   |    2 +-
 arch/x86_64/kernel/Makefile             |    2 +-
 arch/x86_64/kernel/suspend.c            |    4 ++--
 drivers/acpi/sleep/main.c               |    6 +++---
 drivers/acpi/sleep/proc.c               |    2 +-
 drivers/i2c/chips/tps65010.c            |    2 +-
 include/asm-i386/e820.h                 |    2 +-
 include/linux/suspend.h                 |    8 ++++----
 kernel/power/Kconfig                    |    6 +++---
 kernel/power/Makefile                   |    2 +-
 kernel/power/main.c                     |    2 +-
 kernel/power/power.h                    |    2 +-
 kernel/sys.c                            |    2 +-
 mm/Kconfig                              |    4 ++--
 mm/swapfile.c                           |    6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)

Index: linux-2.6.23-rc1/arch/i386/Kconfig.debug
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/Kconfig.debug	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/Kconfig.debug	2007-07-28 20:57:00.000000000 +0200
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
 	  This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+	depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
Index: linux-2.6.23-rc1/arch/i386/kernel/e820.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/kernel/e820.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/kernel/e820.c	2007-07-28 20:57:00.000000000 +0200
@@ -321,7 +321,7 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
Index: linux-2.6.23-rc1/arch/i386/mm/init.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/mm/init.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/mm/init.c	2007-07-28 20:57:00.000000000 +0200
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
 	paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI_SLEEP)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
Index: linux-2.6.23-rc1/arch/i386/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/power/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/i386/power/Makefile	2007-07-28 20:57:00.000000000 +0200
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
Index: linux-2.6.23-rc1/arch/powerpc/Kconfig.debug
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/Kconfig.debug	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/Kconfig.debug	2007-07-28 20:57:00.000000000 +0200
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
Index: linux-2.6.23-rc1/arch/powerpc/configs/lite5200_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/configs/lite5200_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/configs/lite5200_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
Index: linux-2.6.23-rc1/arch/powerpc/configs/pmac32_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/configs/pmac32_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/configs/pmac32_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
Index: linux-2.6.23-rc1/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/arch/powerpc/kernel/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/powerpc/kernel/Makefile	2007-07-28 20:57:00.000000000 +0200
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8540_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8540_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8540_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8541_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8541_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8541_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8555_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8555_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8555_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/TQM8560_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/TQM8560_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/TQM8560_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/ev64360_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/ev64360_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/ev64360_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/ml300_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/ml300_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/ml300_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/ml403_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/ml403_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/ml403_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/mpc834x_sys_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/mpc834x_sys_defconfig	2007-07-28 20:57:00.000000000 +0200
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6.23-rc1/arch/ppc/configs/prep_defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/ppc/configs/prep_defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/ppc/configs/prep_defconfig	2007-07-28 20:57:01.000000000 +0200
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
Index: linux-2.6.23-rc1/arch/sparc64/Kconfig.debug
===================================================================
--- linux-2.6.23-rc1.orig/arch/sparc64/Kconfig.debug	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/sparc64/Kconfig.debug	2007-07-28 20:57:01.000000000 +0200
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && !HIBERNATION
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
Index: linux-2.6.23-rc1/arch/x86_64/defconfig
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/defconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/x86_64/defconfig	2007-07-28 20:57:01.000000000 +0200
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
Index: linux-2.6.23-rc1/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/kernel/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/x86_64/kernel/Makefile	2007-07-28 20:57:01.000000000 +0200
@@ -26,7 +26,7 @@ obj-y				+= io_apic.o mpparse.o genapic.
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_HIBERNATION)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
Index: linux-2.6.23-rc1/arch/x86_64/kernel/suspend.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/kernel/suspend.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/arch/x86_64/kernel/suspend.c	2007-07-28 20:57:01.000000000 +0200
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
Index: linux-2.6.23-rc1/drivers/acpi/sleep/main.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/acpi/sleep/main.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/drivers/acpi/sleep/main.c	2007-07-28 20:57:01.000000000 +0200
@@ -204,7 +204,7 @@ static struct platform_suspend_ops acpi_
 	.finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_start(void)
 {
 	acpi_target_sleep_state = ACPI_STATE_S4;
@@ -266,7 +266,7 @@ static struct platform_hibernation_ops a
 	.pre_restore = acpi_hibernation_pre_restore,
 	.restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif				/* CONFIG_SOFTWARE_SUSPEND */
+#endif				/* CONFIG_HIBERNATION */
 
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -386,7 +386,7 @@ int __init acpi_sleep_init(void)
 
 	suspend_set_ops(&acpi_pm_ops);
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (sleep_states[ACPI_STATE_S4])
 		hibernation_set_ops(&acpi_hibernation_ops);
 #else
Index: linux-2.6.23-rc1/drivers/acpi/sleep/proc.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/acpi/sleep/proc.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/drivers/acpi/sleep/proc.c	2007-07-28 20:57:01.000000000 +0200
@@ -58,7 +58,7 @@ acpi_system_write_sleep(struct file *fil
 		goto Done;
 	}
 	state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (state == 4) {
 		error = hibernate();
 		goto Done;
Index: linux-2.6.23-rc1/drivers/i2c/chips/tps65010.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/i2c/chips/tps65010.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/drivers/i2c/chips/tps65010.c	2007-07-28 20:57:01.000000000 +0200
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tp
 			/* REVISIT:  this might need its own workqueue
 			 * plus tweaks including deadlock avoidance ...
 			 * also needs to get error handling and probably
-			 * an #ifdef CONFIG_SOFTWARE_SUSPEND
+			 * an #ifdef CONFIG_HIBERNATION
 			 */
 			hibernate();
 #endif
Index: linux-2.6.23-rc1/include/asm-i386/e820.h
===================================================================
--- linux-2.6.23-rc1.orig/include/asm-i386/e820.h	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/include/asm-i386/e820.h	2007-07-28 20:57:01.000000000 +0200
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/suspend.h	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/suspend.h	2007-07-28 20:57:01.000000000 +0200
@@ -174,7 +174,7 @@ struct platform_hibernation_ops {
 };
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -192,14 +192,14 @@ extern unsigned long get_safe_page(gfp_t
 
 extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 void save_processor_state(void);
 void restore_processor_state(void);
@@ -240,7 +240,7 @@ static inline int unregister_pm_notifier
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
 #endif /* CONFIG_PM */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Kconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Kconfig	2007-07-28 21:04:06.000000000 +0200
@@ -72,8 +72,8 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
-config SOFTWARE_SUSPEND
-	bool "Software Suspend (Hibernation)"
+config HIBERNATION
+	bool "Hibernation"
 	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
@@ -112,7 +112,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
 	string "Default resume partition"
-	depends on SOFTWARE_SUSPEND
+	depends on HIBERNATION
 	default ""
 	---help---
 	  The default resume partition is the partition that the suspend-
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Makefile	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Makefile	2007-07-28 20:57:01.000000000 +0200
@@ -5,6 +5,6 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/main.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/main.c	2007-07-28 20:57:01.000000000 +0200
@@ -295,7 +295,7 @@ static ssize_t state_show(struct kset *k
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/power.h	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/power.h	2007-07-28 20:57:01.000000000 +0200
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
Index: linux-2.6.23-rc1/kernel/sys.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/sys.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/kernel/sys.c	2007-07-28 20:57:01.000000000 +0200
@@ -954,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, i
 		unlock_kernel();
 		return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{
 			int ret = hibernate();
Index: linux-2.6.23-rc1/mm/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/mm/Kconfig	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/mm/Kconfig	2007-07-28 20:57:01.000000000 +0200
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
 	depends on SPARSEMEM || X86_64_ACPI_NUMA
-	depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+	depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
 	def_bool y
Index: linux-2.6.23-rc1/mm/swapfile.c
===================================================================
--- linux-2.6.23-rc1.orig/mm/swapfile.c	2007-07-28 20:56:27.000000000 +0200
+++ linux-2.6.23-rc1/mm/swapfile.c	2007-07-28 20:57:01.000000000 +0200
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t ent
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pg
 	sis = swap_info + swap_type;
 	return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]     ` <200707291220.14880.rjw@sisk.pl>
  2007-07-29 10:21       ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION Rafael J. Wysocki
@ 2007-07-29 12:38       ` Rafael J. Wysocki
       [not found]       ` <200707291438.06849.rjw@sisk.pl>
                         ` (2 subsequent siblings)
  4 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 12:38 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

Introduce CONFIG_SUSPEND representing the ability to enter system sleep states,
such as the ACPI S3 state, and allow the user to choose SUSPEND and HIBERNATION
independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has been
chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if
CONFIG_SUSPEND or CONFIG_HIBERNATION is set and make CONFIG_ACPI_SLEEP depend
on it.

The top-level power management headers are modified to use the new definitions.
Still, there are many other files in which CONFIG_PM can be replaced with
CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in the
future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/acpi/Kconfig        |    2 +-
 drivers/base/power/Makefile |    6 +++---
 drivers/base/power/power.h  |    4 ++--
 include/acpi/acpi_bus.h     |    7 +++++++
 include/linux/freezer.h     |    6 +++---
 include/linux/pm.h          |    8 ++++----
 include/linux/suspend.h     |   16 ++++++++--------
 kernel/power/Kconfig        |   39 +++++++++++++++++++++++++++++++--------
 kernel/power/Makefile       |    3 ++-
 kernel/power/main.c         |   26 ++++++++++++++++++--------
 kernel/power/power.h        |   10 +++++++++-
 mm/page_alloc.c             |    4 ++--
 12 files changed, 90 insertions(+), 41 deletions(-)

Index: linux-2.6.23-rc1/kernel/power/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Kconfig	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Kconfig	2007-07-29 11:18:49.000000000 +0200
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
 	bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-	depends on PM_DEBUG
+	depends on PM_DEBUG && PM_SLEEP
 	default n
 	---help---
 	This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
 	bool "Suspend/resume event tracing"
-	depends on PM_DEBUG && X86 && EXPERIMENTAL
+	depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
 	default n
 	---help---
 	This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
+config SUSPEND_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+	select HOTPLUG_CPU
+	default y
+
+config PM_SLEEP
+	bool
+	depends on SUSPEND || HIBERNATION
+	default y
+
+config SUSPEND
+	bool "Suspend"
+	depends on PM
+	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	default y
+	---help---
+	  Allow the system to enter sleep states in which main memory is
+	  powered and thus its contents are preserved, such as the
+	  suspend-to-RAM state (i.e. the ACPI S3 state).
+
 config HIBERNATION
 	bool "Hibernation"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +160,6 @@ config PM_STD_PARTITION
 	  suspended image to. It will simply pick the first available swap 
 	  device.
 
-config SUSPEND_SMP
-	bool
-	depends on HOTPLUG_CPU && (X86 || PPC64) && PM
-	default y
-
 config APM_EMULATION
 	tristate "Advanced Power Management Emulation"
 	depends on PM && SYS_SUPPORTS_APM_EMULATION
Index: linux-2.6.23-rc1/kernel/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/Makefile	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/Makefile	2007-07-29 12:53:13.000000000 +0200
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
-obj-y				:= main.o process.o console.o
+obj-y				:= main.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
Index: linux-2.6.23-rc1/drivers/base/power/Makefile
===================================================================
--- linux-2.6.23-rc1.orig/drivers/base/power/Makefile	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/drivers/base/power/Makefile	2007-07-29 11:06:27.000000000 +0200
@@ -1,6 +1,6 @@
-obj-y			:= shutdown.o
-obj-$(CONFIG_PM)	+= main.o suspend.o resume.o sysfs.o
-obj-$(CONFIG_PM_TRACE)	+= trace.o
+obj-y				:= shutdown.o
+obj-$(CONFIG_PM_SLEEP)	+= main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_TRACE)		+= trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
 EXTRA_CFLAGS += -DDEBUG
Index: linux-2.6.23-rc1/include/linux/suspend.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/suspend.h	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/suspend.h	2007-07-29 12:46:45.000000000 +0200
@@ -10,7 +10,7 @@
 #include <linux/pm.h>
 #include <linux/mm.h>
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -77,7 +77,7 @@ struct platform_suspend_ops {
 	void (*finish)(void);
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_SUSPEND
 /**
  * suspend_set_ops - set platform dependent suspend operations
  * @ops: The new suspend operations to set.
@@ -104,12 +104,12 @@ extern void arch_suspend_disable_irqs(vo
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
-#else /* CONFIG_PM */
+#else /* !CONFIG_SUSPEND */
 #define suspend_valid_only_mem	NULL
 
 static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
 static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_SUSPEND */
 
 /* struct pbe is used for creating lists of pages that should be restored
  * atomically during the resume from disk, because the page frames they have
@@ -173,7 +173,6 @@ struct platform_hibernation_ops {
 	void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
 #ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -201,6 +200,7 @@ static inline void hibernation_set_ops(s
 static inline int hibernate(void) { return -ENOSYS; }
 #endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -225,7 +225,7 @@ static inline int unregister_pm_notifier
 		{ .notifier_call = fn, .priority = pri };	\
 	register_pm_notifier(&fn##_nb);			\
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -238,9 +238,9 @@ static inline int unregister_pm_notifier
 }
 
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
Index: linux-2.6.23-rc1/include/linux/pm.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/pm.h	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/pm.h	2007-07-29 11:06:27.000000000 +0200
@@ -175,7 +175,7 @@ typedef struct pm_message {
 struct dev_pm_info {
 	pm_message_t		power_state;
 	unsigned		can_wakeup:1;
-#ifdef	CONFIG_PM
+#ifdef	CONFIG_PM_SLEEP
 	unsigned		should_wakeup:1;
 	struct list_head	entry;
 #endif
@@ -185,7 +185,7 @@ extern int device_power_down(pm_message_
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -215,7 +215,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -232,7 +232,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
Index: linux-2.6.23-rc1/kernel/power/power.h
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/power.h	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/power.h	2007-07-29 11:06:27.000000000 +0200
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
 				unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+	return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
Index: linux-2.6.23-rc1/kernel/power/main.c
===================================================================
--- linux-2.6.23-rc1.orig/kernel/power/main.c	2007-07-29 11:05:14.000000000 +0200
+++ linux-2.6.23-rc1/kernel/power/main.c	2007-07-29 11:11:42.000000000 +0200
@@ -26,14 +26,16 @@
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
 unsigned int pm_flags;
 EXPORT_SYMBOL(pm_flags);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 static struct platform_suspend_ops *suspend_ops;
 
 /**
@@ -272,6 +274,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -288,13 +292,15 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+	char *s = buf;
+#ifdef CONFIG_SUSPEND
 	int i;
-	char * s = buf;
 
 	for (i = 0; i < PM_SUSPEND_MAX; i++) {
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
+#endif
 #ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
@@ -307,11 +313,13 @@ static ssize_t state_show(struct kset *k
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
 	suspend_state_t state = PM_SUSPEND_STANDBY;
 	const char * const *s;
+#endif
 	char *p;
-	int error;
 	int len;
+	int error = -EINVAL;
 
 	p = memchr(buf, '\n', n);
 	len = p ? p - buf : n;
@@ -319,17 +327,19 @@ static ssize_t state_store(struct kset *
 	/* First, check if we are requested to hibernate */
 	if (len == 4 && !strncmp(buf, "disk", len)) {
 		error = hibernate();
-		return error ? error : n;
+  goto Exit;
 	}
 
+#ifdef CONFIG_SUSPEND
 	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 	}
 	if (state < PM_SUSPEND_MAX && *s)
 		error = enter_state(state);
-	else
-		error = -EINVAL;
+#endif
+
+ Exit:
 	return error ? error : n;
 }
 
Index: linux-2.6.23-rc1/drivers/acpi/Kconfig
===================================================================
--- linux-2.6.23-rc1.orig/drivers/acpi/Kconfig	2007-07-28 22:42:57.000000000 +0200
+++ linux-2.6.23-rc1/drivers/acpi/Kconfig	2007-07-29 12:48:49.000000000 +0200
@@ -44,7 +44,7 @@ if ACPI
 
 config ACPI_SLEEP
 	bool "Sleep States"
-	depends on X86 && (!SMP || SUSPEND_SMP)
+	depends on X86 && PM_SLEEP
 	default y
 	---help---
 	  This option adds support for ACPI suspend states. 
Index: linux-2.6.23-rc1/mm/page_alloc.c
===================================================================
--- linux-2.6.23-rc1.orig/mm/page_alloc.c	2007-07-23 22:07:02.000000000 +0200
+++ linux-2.6.23-rc1/mm/page_alloc.c	2007-07-29 12:23:44.000000000 +0200
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int c
 	}
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
Index: linux-2.6.23-rc1/drivers/base/power/power.h
===================================================================
--- linux-2.6.23-rc1.orig/drivers/base/power/power.h	2007-07-26 13:00:38.000000000 +0200
+++ linux-2.6.23-rc1/drivers/base/power/power.h	2007-07-29 12:26:23.000000000 +0200
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
Index: linux-2.6.23-rc1/include/linux/freezer.h
===================================================================
--- linux-2.6.23-rc1.orig/include/linux/freezer.h	2007-07-26 20:51:27.000000000 +0200
+++ linux-2.6.23-rc1/include/linux/freezer.h	2007-07-29 12:38:57.000000000 +0200
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -157,7 +157,7 @@ static inline void set_freezable(void)
 	} while (try_to_freeze());					\
 	__ret;								\
 })
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -181,6 +181,6 @@ static inline void set_freezable(void) {
 #define wait_event_freezable_timeout(wq, condition, timeout)		\
 		wait_event_interruptible_timeout(wq, condition, timeout)
 
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif	/* FREEZER_H_INCLUDED */
Index: linux-2.6.23-rc1/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.23-rc1.orig/include/acpi/acpi_bus.h	2007-07-26 20:51:27.000000000 +0200
+++ linux-2.6.23-rc1/include/acpi/acpi_bus.h	2007-07-29 13:21:09.000000000 +0200
@@ -365,7 +365,14 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_ACPI_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_ACPI_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+	return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_ACPI_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]       ` <200707291438.06849.rjw@sisk.pl>
@ 2007-07-29 20:40         ` Adrian Bunk
       [not found]         ` <20070729204001.GJ16817@stusta.de>
  1 sibling, 0 replies; 28+ messages in thread
From: Adrian Bunk @ 2007-07-29 20:40 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: david, Nigel Cunningham, linux-kernel, linux-acpi, Stefan Richter,
	Pavel Machek, Andrew Morton, Linus Torvalds, pm list

On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
>...
> +config SUSPEND
> +	bool "Suspend"
             "Suspend to RAM"
>...
>  config HIBERNATION
>  	bool "Hibernation"
>...         "Hibernation (Suspend to disk)"

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]         ` <20070729204001.GJ16817@stusta.de>
@ 2007-07-29 21:17           ` Rafael J. Wysocki
       [not found]           ` <200707292317.21419.rjw@sisk.pl>
  1 sibling, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:17 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: david, Nigel Cunningham, linux-kernel, linux-acpi, Stefan Richter,
	Pavel Machek, Andrew Morton, Linus Torvalds, pm list

On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> >...
> > +config SUSPEND
> > +	bool "Suspend"
>              "Suspend to RAM"

Not only.  This also includes "standby".

> >...
> >  config HIBERNATION
> >  	bool "Hibernation"
> >...         "Hibernation (Suspend to disk)"
> 
> cu
> Adrian

Greetings,
Rafael


-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]           ` <200707292317.21419.rjw@sisk.pl>
@ 2007-07-29 21:18             ` Adrian Bunk
       [not found]             ` <20070729211824.GL16817@stusta.de>
  1 sibling, 0 replies; 28+ messages in thread
From: Adrian Bunk @ 2007-07-29 21:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: david, Nigel Cunningham, linux-kernel, linux-acpi, Stefan Richter,
	Pavel Machek, Andrew Morton, Linus Torvalds, pm list

On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > >...
> > > +config SUSPEND
> > > +	bool "Suspend"
> >              "Suspend to RAM"
> 
> Not only.  This also includes "standby".

Whatever it includes - please tell it to the user in the prompt.

Technical issues are important, but it's often forgotten how many 
problems people run into because the description of a kconfig option 
could have been better.

> > >...
> > >  config HIBERNATION
> > >  	bool "Hibernation"
> > >...         "Hibernation (Suspend to disk)"
> > 
> > cu
> > Adrian
> 
> Greetings,
> Rafael
> 
> 
> -- 
> "Premature optimization is the root of all evil." - Donald Knuth

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
       [not found]     ` <200707291220.14880.rjw@sisk.pl>
                         ` (2 preceding siblings ...)
       [not found]       ` <200707291438.06849.rjw@sisk.pl>
@ 2007-07-29 21:23       ` Rafael J. Wysocki
       [not found]       ` <200707292323.29601.rjw@sisk.pl>
  4 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:23 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

On Sunday, 29 July 2007 12:20, Rafael J. Wysocki wrote:
> On Saturday, 28 July 2007 20:31, Linus Torvalds wrote:
> > 
> > On Sat, 28 Jul 2007, Rafael J. Wysocki wrote:
> > > 
> > > OK, I'll prepare a patch to introduce CONFIG_SUSPEND, but that will require
> > > quite a bit of (compilation) testing on different architectures.
> > 
> > Sure. I'm not too worried, the fallout should be of the trivial kind. 
> >
> > Also, mind basing it on the (independent) cleanups that Adrian already 
> > sent out. This is all intertwined..
> 
> OK, it took more time than I had hoped, but I wanted CONFIG_HIBERNATION and
> CONFIG_SUSPEND to be really independent of each other.
> 
> The two patches in the next messages implement the idea:
> * replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
> * introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary,
>   and make it possible to choose suspend and hibernation independently of each
>   other.

Unfortunately, the patches that I have posted are against 2.6.23-rc1 with the
suspend and hibernation patchset applied
(http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.23-rc1/patches/) .

Sorry for that.

The corresponding patches on top of the current -git are in the next two
messages.

They do the following:
* replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION
* introduce CONFIG_SUSPEND that selects CONFIG_HOTPLUG_CPU, if necessary,
  and make it possible to choose suspend and hibernation independently of each
  other
* update the top-level PM-related headers and the ACPI code related to suspend
  and hibernation to use the new definitions

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated)
       [not found]       ` <200707292323.29601.rjw@sisk.pl>
@ 2007-07-29 21:24         ` Rafael J. Wysocki
  2007-07-29 21:27         ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid confusion
(among other things, with CONFIG_SUSPEND introduced in the next patch).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/i386/Kconfig.debug                 |    4 ++--
 arch/i386/kernel/e820.c                 |    2 +-
 arch/i386/mm/init.c                     |    2 +-
 arch/i386/power/Makefile                |    2 +-
 arch/powerpc/Kconfig.debug              |    2 +-
 arch/powerpc/configs/lite5200_defconfig |    2 +-
 arch/powerpc/configs/pmac32_defconfig   |    2 +-
 arch/powerpc/kernel/Makefile            |    6 +++---
 arch/ppc/configs/TQM8540_defconfig      |    2 +-
 arch/ppc/configs/TQM8541_defconfig      |    2 +-
 arch/ppc/configs/TQM8555_defconfig      |    2 +-
 arch/ppc/configs/TQM8560_defconfig      |    2 +-
 arch/ppc/configs/ev64360_defconfig      |    2 +-
 arch/ppc/configs/ml300_defconfig        |    2 +-
 arch/ppc/configs/ml403_defconfig        |    2 +-
 arch/ppc/configs/mpc834x_sys_defconfig  |    2 +-
 arch/ppc/configs/prep_defconfig         |    2 +-
 arch/sparc64/Kconfig.debug              |    2 +-
 arch/x86_64/defconfig                   |    2 +-
 arch/x86_64/kernel/Makefile             |    2 +-
 arch/x86_64/kernel/suspend.c            |    4 ++--
 drivers/acpi/sleep/main.c               |    6 +++---
 drivers/acpi/sleep/proc.c               |    2 +-
 drivers/i2c/chips/tps65010.c            |    2 +-
 include/asm-i386/e820.h                 |    2 +-
 include/linux/suspend.h                 |    8 ++++----
 kernel/power/Kconfig                    |    6 +++---
 kernel/power/Makefile                   |    2 +-
 kernel/power/main.c                     |    2 +-
 kernel/power/power.h                    |    2 +-
 kernel/sys.c                            |    2 +-
 mm/Kconfig                              |    4 ++--
 mm/swapfile.c                           |    6 +++---
 33 files changed, 47 insertions(+), 47 deletions(-)

Index: linux-2.6/arch/i386/Kconfig.debug
===================================================================
--- linux-2.6.orig/arch/i386/Kconfig.debug	2007-05-10 21:34:50.000000000 +0200
+++ linux-2.6/arch/i386/Kconfig.debug	2007-07-29 18:49:05.000000000 +0200
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
 	  This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+	depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
Index: linux-2.6/arch/i386/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/e820.c	2007-07-27 21:34:36.000000000 +0200
+++ linux-2.6/arch/i386/kernel/e820.c	2007-07-29 18:49:05.000000000 +0200
@@ -321,7 +321,7 @@ static int __init request_standard_resou
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
Index: linux-2.6/arch/i386/mm/init.c
===================================================================
--- linux-2.6.orig/arch/i386/mm/init.c	2007-07-27 21:34:36.000000000 +0200
+++ linux-2.6/arch/i386/mm/init.c	2007-07-29 18:49:05.000000000 +0200
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
 	paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
Index: linux-2.6/arch/i386/power/Makefile
===================================================================
--- linux-2.6.orig/arch/i386/power/Makefile	2007-05-10 21:34:50.000000000 +0200
+++ linux-2.6/arch/i386/power/Makefile	2007-07-29 18:49:05.000000000 +0200
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
Index: linux-2.6/arch/powerpc/Kconfig.debug
===================================================================
--- linux-2.6.orig/arch/powerpc/Kconfig.debug	2007-07-27 21:34:36.000000000 +0200
+++ linux-2.6/arch/powerpc/Kconfig.debug	2007-07-29 18:49:05.000000000 +0200
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
Index: linux-2.6/arch/powerpc/configs/lite5200_defconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/configs/lite5200_defconfig	2007-06-27 23:17:46.000000000 +0200
+++ linux-2.6/arch/powerpc/configs/lite5200_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
Index: linux-2.6/arch/powerpc/configs/pmac32_defconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/configs/pmac32_defconfig	2007-06-27 23:17:46.000000000 +0200
+++ linux-2.6/arch/powerpc/configs/pmac32_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/Makefile	2007-07-18 22:37:31.000000000 +0200
+++ linux-2.6/arch/powerpc/kernel/Makefile	2007-07-29 18:49:05.000000000 +0200
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
Index: linux-2.6/arch/ppc/configs/TQM8540_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8540_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8540_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/TQM8541_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8541_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8541_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/TQM8555_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8555_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8555_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/TQM8560_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/TQM8560_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/TQM8560_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/ev64360_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/ev64360_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/ev64360_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/ml300_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/ml300_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/ml300_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/ml403_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/ml403_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/ml403_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/mpc834x_sys_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/mpc834x_sys_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/mpc834x_sys_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
Index: linux-2.6/arch/ppc/configs/prep_defconfig
===================================================================
--- linux-2.6.orig/arch/ppc/configs/prep_defconfig	2007-05-10 21:34:51.000000000 +0200
+++ linux-2.6/arch/ppc/configs/prep_defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
Index: linux-2.6/arch/sparc64/Kconfig.debug
===================================================================
--- linux-2.6.orig/arch/sparc64/Kconfig.debug	2007-05-10 21:34:52.000000000 +0200
+++ linux-2.6/arch/sparc64/Kconfig.debug	2007-07-29 18:49:05.000000000 +0200
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
 	bool "Debug page memory allocations"
-	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+	depends on DEBUG_KERNEL && !HIBERNATION
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
--- linux-2.6.orig/arch/x86_64/defconfig	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/arch/x86_64/defconfig	2007-07-29 18:49:05.000000000 +0200
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
Index: linux-2.6/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/Makefile	2007-07-12 23:57:06.000000000 +0200
+++ linux-2.6/arch/x86_64/kernel/Makefile	2007-07-29 18:49:05.000000000 +0200
@@ -26,7 +26,7 @@ obj-y				+= io_apic.o mpparse.o genapic.
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_HIBERNATION)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IOMMU)		+= pci-gart.o aperture.o
Index: linux-2.6/arch/x86_64/kernel/suspend.c
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/suspend.c	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/arch/x86_64/kernel/suspend.c	2007-07-29 18:49:05.000000000 +0200
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
 	unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
 	return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/main.c	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/main.c	2007-07-29 18:49:06.000000000 +0200
@@ -202,7 +202,7 @@ static struct pm_ops acpi_pm_ops = {
 	.finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_prepare(void)
 {
 	return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -254,7 +254,7 @@ static struct hibernation_ops acpi_hiber
 	.pre_restore = acpi_hibernation_pre_restore,
 	.restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif				/* CONFIG_SOFTWARE_SUSPEND */
+#endif				/* CONFIG_HIBERNATION */
 
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -374,7 +374,7 @@ int __init acpi_sleep_init(void)
 
 	pm_set_ops(&acpi_pm_ops);
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (sleep_states[ACPI_STATE_S4])
 		hibernation_set_ops(&acpi_hibernation_ops);
 #else
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/proc.c	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/proc.c	2007-07-29 18:49:06.000000000 +0200
@@ -66,7 +66,7 @@ acpi_system_write_sleep(struct file *fil
 		goto Done;
 	}
 	state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	if (state == 4) {
 		error = hibernate();
 		goto Done;
Index: linux-2.6/drivers/i2c/chips/tps65010.c
===================================================================
--- linux-2.6.orig/drivers/i2c/chips/tps65010.c	2007-05-10 21:34:53.000000000 +0200
+++ linux-2.6/drivers/i2c/chips/tps65010.c	2007-07-29 18:49:06.000000000 +0200
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tp
 			/* REVISIT:  this might need its own workqueue
 			 * plus tweaks including deadlock avoidance ...
 			 * also needs to get error handling and probably
-			 * an #ifdef CONFIG_SOFTWARE_SUSPEND
+			 * an #ifdef CONFIG_HIBERNATION
 			 */
 			hibernate();
 #endif
Index: linux-2.6/include/asm-i386/e820.h
===================================================================
--- linux-2.6.orig/include/asm-i386/e820.h	2007-07-27 21:34:41.000000000 +0200
+++ linux-2.6/include/asm-i386/e820.h	2007-07-29 18:49:06.000000000 +0200
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
Index: linux-2.6/include/linux/suspend.h
===================================================================
--- linux-2.6.orig/include/linux/suspend.h	2007-07-27 21:34:42.000000000 +0200
+++ linux-2.6/include/linux/suspend.h	2007-07-29 18:49:06.000000000 +0200
@@ -55,7 +55,7 @@ struct hibernation_ops {
 };
 
 #ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -73,14 +73,14 @@ extern unsigned long get_safe_page(gfp_t
 
 extern void hibernation_set_ops(struct hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 void save_processor_state(void);
 void restore_processor_state(void);
@@ -121,7 +121,7 @@ static inline int unregister_pm_notifier
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
 #endif /* CONFIG_PM */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
Index: linux-2.6/kernel/power/Kconfig
===================================================================
--- linux-2.6.orig/kernel/power/Kconfig	2007-07-27 21:34:42.000000000 +0200
+++ linux-2.6/kernel/power/Kconfig	2007-07-29 18:53:40.000000000 +0200
@@ -72,8 +72,8 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
-config SOFTWARE_SUSPEND
-	bool "Software Suspend (Hibernation)"
+config HIBERNATION
+	bool "Hibernation"
 	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
@@ -112,7 +112,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
 	string "Default resume partition"
-	depends on SOFTWARE_SUSPEND
+	depends on HIBERNATION
 	default ""
 	---help---
 	  The default resume partition is the partition that the suspend-
Index: linux-2.6/kernel/power/Makefile
===================================================================
--- linux-2.6.orig/kernel/power/Makefile	2007-05-13 14:43:17.000000000 +0200
+++ linux-2.6/kernel/power/Makefile	2007-07-29 18:49:06.000000000 +0200
@@ -5,6 +5,6 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c	2007-07-20 21:51:36.000000000 +0200
+++ linux-2.6/kernel/power/main.c	2007-07-29 18:49:06.000000000 +0200
@@ -292,7 +292,7 @@ static ssize_t state_show(struct kset *k
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
Index: linux-2.6/kernel/power/power.h
===================================================================
--- linux-2.6.orig/kernel/power/power.h	2007-07-20 21:51:36.000000000 +0200
+++ linux-2.6/kernel/power/power.h	2007-07-29 18:49:06.000000000 +0200
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
Index: linux-2.6/kernel/sys.c
===================================================================
--- linux-2.6.orig/kernel/sys.c	2007-07-27 21:34:42.000000000 +0200
+++ linux-2.6/kernel/sys.c	2007-07-29 18:49:06.000000000 +0200
@@ -954,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, i
 		unlock_kernel();
 		return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{
 			int ret = hibernate();
Index: linux-2.6/mm/Kconfig
===================================================================
--- linux-2.6.orig/mm/Kconfig	2007-07-18 22:37:43.000000000 +0200
+++ linux-2.6/mm/Kconfig	2007-07-29 18:49:06.000000000 +0200
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
 	depends on SPARSEMEM || X86_64_ACPI_NUMA
-	depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+	depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
 	def_bool y
Index: linux-2.6/mm/swapfile.c
===================================================================
--- linux-2.6.orig/mm/swapfile.c	2007-07-18 22:37:43.000000000 +0200
+++ linux-2.6/mm/swapfile.c	2007-07-29 18:49:06.000000000 +0200
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t ent
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_
 	}
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pg
 	sis = swap_info + swap_type;
 	return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
       [not found]       ` <200707292323.29601.rjw@sisk.pl>
  2007-07-29 21:24         ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
@ 2007-07-29 21:27         ` Rafael J. Wysocki
  2007-07-30  0:21         ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
       [not found]         ` <200707292327.19884.rjw@sisk.pl>
  3 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

From: Rafael J. Wysocki <rjw@sisk.pl>

Introduce CONFIG_SUSPEND representing the ability to enter system sleep states,
such as the ACPI S3 state, and allow the user to choose SUSPEND and HIBERNATION
independently of each other.

Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has been
chosen and the kernel is intended for SMP systems.

Also, introduce CONFIG_PM_SLEEP which is automatically selected if
CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the code
needed for both suspend and hibernation.

The top-level power management headers and the ACPI code related to suspend and
hibernation are modified to use the new definitions (the changes in
drivers/acpi/sleep/main.c are, mostly, moving code to reduce the number of
ifdefs).  Still, there are many other files in which CONFIG_PM can be replaced
with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
the future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/acpi/Kconfig        |    8 +++
 drivers/acpi/sleep/Makefile |    2 
 drivers/acpi/sleep/main.c   |   94 +++++++++++++++++++++++---------------------
 drivers/acpi/sleep/proc.c   |   10 ++--
 drivers/acpi/sleep/sleep.h  |    2 
 drivers/base/power/Makefile |    2 
 drivers/base/power/power.h  |    4 -
 include/acpi/acpi_bus.h     |    9 ++++
 include/acpi/acpi_drivers.h |    4 +
 include/linux/freezer.h     |    6 +-
 include/linux/pm.h          |   15 +++++--
 include/linux/suspend.h     |   10 ++--
 kernel/power/Kconfig        |   39 ++++++++++++++----
 kernel/power/Makefile       |    3 -
 kernel/power/main.c         |   26 ++++++++----
 kernel/power/power.h        |   10 ++++
 mm/page_alloc.c             |    4 -
 17 files changed, 163 insertions(+), 85 deletions(-)

Index: linux-2.6/kernel/power/Kconfig
===================================================================
--- linux-2.6.orig/kernel/power/Kconfig	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/Kconfig	2007-07-29 19:06:48.000000000 +0200
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
 	bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-	depends on PM_DEBUG
+	depends on PM_DEBUG && PM_SLEEP
 	default n
 	---help---
 	This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
 	bool "Suspend/resume event tracing"
-	depends on PM_DEBUG && X86 && EXPERIMENTAL
+	depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
 	default n
 	---help---
 	This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
+config SUSPEND_SMP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	depends on SMP
+	default y
+
+config SUSPEND_SMP
+	bool
+	depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+	select HOTPLUG_CPU
+	default y
+
+config PM_SLEEP
+	bool
+	depends on SUSPEND || HIBERNATION
+	default y
+
+config SUSPEND
+	bool "Suspend to RAM and standby"
+	depends on PM
+	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	default y
+	---help---
+	  Allow the system to enter sleep states in which main memory is
+	  powered and thus its contents are preserved, such as the
+	  suspend-to-RAM state (i.e. the ACPI S3 state).
+
 config HIBERNATION
 	bool "Hibernation"
-	depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+	depends on PM && SWAP
+	depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
@@ -132,11 +160,6 @@ config PM_STD_PARTITION
 	  suspended image to. It will simply pick the first available swap 
 	  device.
 
-config SUSPEND_SMP
-	bool
-	depends on HOTPLUG_CPU && (X86 || PPC64) && PM
-	default y
-
 config APM_EMULATION
 	tristate "Advanced Power Management Emulation"
 	depends on PM && SYS_SUPPORTS_APM_EMULATION
Index: linux-2.6/kernel/power/Makefile
===================================================================
--- linux-2.6.orig/kernel/power/Makefile	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/Makefile	2007-07-29 19:06:48.000000000 +0200
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
-obj-y				:= main.o process.o console.o
+obj-y				:= main.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
Index: linux-2.6/drivers/base/power/Makefile
===================================================================
--- linux-2.6.orig/drivers/base/power/Makefile	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/drivers/base/power/Makefile	2007-07-29 19:06:48.000000000 +0200
@@ -1,5 +1,5 @@
 obj-y			:= shutdown.o
-obj-$(CONFIG_PM)	+= main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_SLEEP)	+= main.o suspend.o resume.o sysfs.o
 obj-$(CONFIG_PM_TRACE)	+= trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
Index: linux-2.6/include/linux/suspend.h
===================================================================
--- linux-2.6.orig/include/linux/suspend.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/linux/suspend.h	2007-07-29 19:06:48.000000000 +0200
@@ -24,7 +24,7 @@ struct pbe {
 extern void drain_local_pages(void);
 extern void mark_free_pages(struct zone *zone);
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -54,7 +54,6 @@ struct hibernation_ops {
 	void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
 #ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -82,6 +81,7 @@ static inline void hibernation_set_ops(s
 static inline int hibernate(void) { return -ENOSYS; }
 #endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -106,7 +106,7 @@ static inline int unregister_pm_notifier
 		{ .notifier_call = fn, .priority = pri };	\
 	register_pm_notifier(&fn##_nb);			\
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -119,9 +119,9 @@ static inline int unregister_pm_notifier
 }
 
 #define pm_notifier(fn, pri)	do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_HIBERNATION || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
Index: linux-2.6/include/linux/pm.h
===================================================================
--- linux-2.6.orig/include/linux/pm.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/linux/pm.h	2007-07-29 20:05:02.000000000 +0200
@@ -165,6 +165,7 @@ struct pm_ops {
 	int (*finish)(suspend_state_t state);
 };
 
+#ifdef CONFIG_SUSPEND
 extern struct pm_ops *pm_ops;
 
 /**
@@ -193,6 +194,12 @@ extern void arch_suspend_disable_irqs(vo
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+#define suspend_valid_only_mem	NULL
+
+static inline void pm_set_ops(struct pm_ops *pm_ops) {}
+static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
+#endif /* !CONFIG_SUSPEND */
 
 /*
  * Device power management
@@ -266,7 +273,7 @@ typedef struct pm_message {
 struct dev_pm_info {
 	pm_message_t		power_state;
 	unsigned		can_wakeup:1;
-#ifdef	CONFIG_PM
+#ifdef	CONFIG_PM_SLEEP
 	unsigned		should_wakeup:1;
 	struct list_head	entry;
 #endif
@@ -276,7 +283,7 @@ extern int device_power_down(pm_message_
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -306,7 +313,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -323,7 +330,7 @@ static inline int call_platform_enable_w
 	return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
Index: linux-2.6/kernel/power/power.h
===================================================================
--- linux-2.6.orig/kernel/power/power.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/power.h	2007-07-29 19:06:48.000000000 +0200
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
 				unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+	return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/kernel/power/main.c	2007-07-29 19:06:48.000000000 +0200
@@ -25,11 +25,13 @@
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 struct pm_ops *pm_ops;
 
 /**
@@ -269,6 +271,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -285,13 +289,15 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+	char *s = buf;
+#ifdef CONFIG_SUSPEND
 	int i;
-	char * s = buf;
 
 	for (i = 0; i < PM_SUSPEND_MAX; i++) {
 		if (pm_states[i] && valid_state(i))
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
+#endif
 #ifdef CONFIG_HIBERNATION
 	s += sprintf(s, "%s\n", "disk");
 #else
@@ -304,11 +310,13 @@ static ssize_t state_show(struct kset *k
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
 	suspend_state_t state = PM_SUSPEND_STANDBY;
 	const char * const *s;
+#endif
 	char *p;
-	int error;
 	int len;
+	int error = -EINVAL;
 
 	p = memchr(buf, '\n', n);
 	len = p ? p - buf : n;
@@ -316,17 +324,19 @@ static ssize_t state_store(struct kset *
 	/* First, check if we are requested to hibernate */
 	if (len == 4 && !strncmp(buf, "disk", len)) {
 		error = hibernate();
-		return error ? error : n;
+  goto Exit;
 	}
 
+#ifdef CONFIG_SUSPEND
 	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 	}
 	if (state < PM_SUSPEND_MAX && *s)
 		error = enter_state(state);
-	else
-		error = -EINVAL;
+#endif
+
+ Exit:
 	return error ? error : n;
 }
 
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/mm/page_alloc.c	2007-07-29 19:06:48.000000000 +0200
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int c
 	}
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
Index: linux-2.6/drivers/base/power/power.h
===================================================================
--- linux-2.6.orig/drivers/base/power/power.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/drivers/base/power/power.h	2007-07-29 19:06:48.000000000 +0200
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
Index: linux-2.6/include/linux/freezer.h
===================================================================
--- linux-2.6.orig/include/linux/freezer.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/linux/freezer.h	2007-07-29 19:06:48.000000000 +0200
@@ -5,7 +5,7 @@
 
 #include <linux/sched.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -126,7 +126,7 @@ static inline void set_freezable(void)
 	current->flags &= ~PF_NOFREEZE;
 }
 
-#else
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -143,6 +143,6 @@ static inline void freezer_do_not_count(
 static inline void freezer_count(void) {}
 static inline int freezer_should_skip(struct task_struct *p) { return 0; }
 static inline void set_freezable(void) {}
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif	/* FREEZER_H_INCLUDED */
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h	2007-07-29 19:06:26.000000000 +0200
+++ linux-2.6/include/acpi/acpi_bus.h	2007-07-29 19:06:48.000000000 +0200
@@ -366,7 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_PM_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_PM_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+	if (p)
+		*p = ACPI_STATE_D0;
+	return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
Index: linux-2.6/drivers/acpi/sleep/Makefile
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/Makefile	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/Makefile	2007-07-29 19:13:59.000000000 +0200
@@ -1,5 +1,5 @@
 obj-y					:= poweroff.o wakeup.o
-obj-y					+= main.o
+obj-$(CONFIG_PM_SLEEP)			+= main.o
 obj-$(CONFIG_X86)			+= proc.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
Index: linux-2.6/drivers/acpi/Kconfig
===================================================================
--- linux-2.6.orig/drivers/acpi/Kconfig	2007-07-27 21:34:37.000000000 +0200
+++ linux-2.6/drivers/acpi/Kconfig	2007-07-29 21:07:18.000000000 +0200
@@ -63,6 +63,14 @@ config ACPI_PROCFS
 
 	  Say N to delete /proc/acpi/ files that have moved to /sys/
 
+config ACPI_PROCFS_SLEEP
+	bool "/proc/acpi/sleep (deprecated)"
+	depends on PM_SLEEP && ACPI_PROCFS
+	default n
+	---help---
+	  Create /proc/acpi/sleep
+	  Deprecated by /sys/power/state
+
 config ACPI_AC
 	tristate "AC Adapter"
 	depends on X86
Index: linux-2.6/drivers/acpi/sleep/proc.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/proc.c	2007-07-29 19:06:03.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/proc.c	2007-07-29 19:33:11.000000000 +0200
@@ -23,7 +23,7 @@
  */
 
 ACPI_MODULE_NAME("sleep")
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
 {
 	int i;
@@ -76,7 +76,7 @@ acpi_system_write_sleep(struct file *fil
       Done:
 	return error ? error : count;
 }
-#endif				/* CONFIG_ACPI_PROCFS */
+#endif				/* CONFIG_ACPI_PROCFS_SLEEP */
 
 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
@@ -471,7 +471,7 @@ static const struct file_operations acpi
 	.release = single_release,
 };
 
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 static const struct file_operations acpi_system_sleep_fops = {
 	.open = acpi_system_sleep_open_fs,
 	.read = seq_read,
@@ -479,7 +479,7 @@ static const struct file_operations acpi
 	.llseek = seq_lseek,
 	.release = single_release,
 };
-#endif				/* CONFIG_ACPI_PROCFS */
+#endif				/* CONFIG_ACPI_PROCFS_SLEEP */
 
 #ifdef	HAVE_ACPI_LEGACY_ALARM
 static const struct file_operations acpi_system_alarm_fops = {
@@ -506,7 +506,7 @@ static int __init acpi_sleep_proc_init(v
 	if (acpi_disabled)
 		return 0;
 
-#ifdef	CONFIG_ACPI_PROCFS
+#ifdef	CONFIG_ACPI_PROCFS_SLEEP
 	/* 'sleep' [R/W] */
 	entry =
 	    create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
Index: linux-2.6/include/acpi/acpi_drivers.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_drivers.h	2007-07-29 19:40:59.000000000 +0200
+++ linux-2.6/include/acpi/acpi_drivers.h	2007-07-29 19:41:55.000000000 +0200
@@ -147,6 +147,10 @@ static inline void unregister_hotplug_do
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_PM_SLEEP
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return 0; }
+#endif
 
 #endif /*__ACPI_DRIVERS_H__*/
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/main.c	2007-07-29 19:06:03.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/main.c	2007-07-29 22:06:59.000000000 +0200
@@ -21,6 +21,9 @@
 
 u8 sleep_states[ACPI_S_STATE_COUNT];
 
+static u32 acpi_target_sleep_state = ACPI_STATE_S0;
+
+#ifdef CONFIG_SUSPEND
 static struct pm_ops acpi_pm_ops;
 
 extern void do_suspend_lowlevel(void);
@@ -34,11 +37,6 @@ static u32 acpi_suspend_states[] = {
 
 static int init_8259A_after_S1;
 
-extern int acpi_sleep_prepare(u32 acpi_state);
-extern void acpi_power_off(void);
-
-static u32 acpi_target_sleep_state = ACPI_STATE_S0;
-
 /**
  *	acpi_pm_set_target - Set the target system sleep state to the state
  *		associated with given @pm_state, if supported.
@@ -163,21 +161,6 @@ static int acpi_pm_finish(suspend_state_
 	return 0;
 }
 
-int acpi_suspend(u32 acpi_state)
-{
-	suspend_state_t states[] = {
-		[1] = PM_SUSPEND_STANDBY,
-		[3] = PM_SUSPEND_MEM,
-		[5] = PM_SUSPEND_MAX
-	};
-
-	if (acpi_state < 6 && states[acpi_state])
-		return pm_suspend(states[acpi_state]);
-	if (acpi_state == 4)
-		return hibernate();
-	return -EINVAL;
-}
-
 static int acpi_pm_state_valid(suspend_state_t pm_state)
 {
 	u32 acpi_state;
@@ -202,6 +185,27 @@ static struct pm_ops acpi_pm_ops = {
 	.finish = acpi_pm_finish,
 };
 
+/*
+ * Toshiba fails to preserve interrupts over S1, reinitialization
+ * of 8259 is needed after S1 resume.
+ */
+static int __init init_ints_after_s1(struct dmi_system_id *d)
+{
+	printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
+	init_8259A_after_S1 = 1;
+	return 0;
+}
+
+static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
+	{
+	 .callback = init_ints_after_s1,
+	 .ident = "Toshiba Satellite 4030cdt",
+	 .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
+	 },
+	{},
+};
+#endif /* CONFIG_SUSPEND */
+
 #ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_prepare(void)
 {
@@ -256,6 +260,21 @@ static struct hibernation_ops acpi_hiber
 };
 #endif				/* CONFIG_HIBERNATION */
 
+int acpi_suspend(u32 acpi_state)
+{
+	suspend_state_t states[] = {
+		[1] = PM_SUSPEND_STANDBY,
+		[3] = PM_SUSPEND_MEM,
+		[5] = PM_SUSPEND_MAX
+	};
+
+	if (acpi_state < 6 && states[acpi_state])
+		return pm_suspend(states[acpi_state]);
+	if (acpi_state == 4)
+		return hibernate();
+	return -EINVAL;
+}
+
 /**
  *	acpi_pm_device_sleep_state - return preferred power state of ACPI device
  *		in the system sleep state given by %acpi_target_sleep_state
@@ -331,39 +350,22 @@ int acpi_pm_device_sleep_state(struct de
 	return d_max;
 }
 
-/*
- * Toshiba fails to preserve interrupts over S1, reinitialization
- * of 8259 is needed after S1 resume.
- */
-static int __init init_ints_after_s1(struct dmi_system_id *d)
-{
-	printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
-	init_8259A_after_S1 = 1;
-	return 0;
-}
-
-static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
-	{
-	 .callback = init_ints_after_s1,
-	 .ident = "Toshiba Satellite 4030cdt",
-	 .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
-	 },
-	{},
-};
-
 int __init acpi_sleep_init(void)
 {
+	acpi_status status;
+	u8 type_a, type_b;
+#ifdef CONFIG_SUSPEND
 	int i = 0;
 
 	dmi_check_system(acpisleep_dmi_table);
+#endif
 
 	if (acpi_disabled)
 		return 0;
 
+#ifdef CONFIG_SUSPEND
 	printk(KERN_INFO PREFIX "(supports");
-	for (i = 0; i < ACPI_S_STATE_COUNT; i++) {
-		acpi_status status;
-		u8 type_a, type_b;
+	for (i = ACPI_STATE_S0; i < ACPI_STATE_S4; i++) {
 		status = acpi_get_sleep_type_data(i, &type_a, &type_b);
 		if (ACPI_SUCCESS(status)) {
 			sleep_states[i] = 1;
@@ -373,10 +375,14 @@ int __init acpi_sleep_init(void)
 	printk(")\n");
 
 	pm_set_ops(&acpi_pm_ops);
+#endif
 
 #ifdef CONFIG_HIBERNATION
-	if (sleep_states[ACPI_STATE_S4])
+	status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
+	if (ACPI_SUCCESS(status)) {
 		hibernation_set_ops(&acpi_hibernation_ops);
+		sleep_states[ACPI_STATE_S4] = 1;
+	}
 #else
 	sleep_states[ACPI_STATE_S4] = 0;
 #endif
Index: linux-2.6/drivers/acpi/sleep/sleep.h
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep/sleep.h	2007-05-10 21:34:52.000000000 +0200
+++ linux-2.6/drivers/acpi/sleep/sleep.h	2007-07-29 20:26:01.000000000 +0200
@@ -6,3 +6,5 @@ extern void acpi_enable_wakeup_device_pr
 extern void acpi_enable_wakeup_device(u8 sleep_state);
 extern void acpi_disable_wakeup_device(u8 sleep_state);
 extern void acpi_gpe_sleep_prepare(u32 sleep_state);
+
+extern int acpi_sleep_prepare(u32 acpi_state);

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]               ` <200707292336.55588.rjw@sisk.pl>
@ 2007-07-29 21:30                 ` Richard Hughes
       [not found]                 ` <1185744640.2295.4.camel@work>
  1 sibling, 0 replies; 28+ messages in thread
From: Richard Hughes @ 2007-07-29 21:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds,
	pm list

On Sun, 2007-07-29 at 23:36 +0200, Rafael J. Wysocki wrote:
> On Sunday, 29 July 2007 23:18, Adrian Bunk wrote:
> > On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> > > On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > > > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > > > >...
> > > > > +config SUSPEND
> > > > > +	bool "Suspend"
> > > >              "Suspend to RAM"
> > > 
> > > Not only.  This also includes "standby".
> > 
> > Whatever it includes - please tell it to the user in the prompt.
> > 
> > Technical issues are important, but it's often forgotten how many 
> > problems people run into because the description of a kconfig option 
> > could have been better.
> 
> Sure.  Please see the updated patch I've just sent. :-)

So are you guys using:

"standby" = idle state, ~0.5 seconds
"suspend" = sleep to ram, ~10 seconds
"hibernate" = sleep to disk, ~30 seconds

If so - you rock. This is the common nomenclature I've been pushing for
a few months now in GNOME, KDE and general userspace. I've written up a
spec here:
http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/sleep-names.html

Richard.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]             ` <20070729211824.GL16817@stusta.de>
       [not found]               ` <200707292336.55588.rjw@sisk.pl>
@ 2007-07-29 21:36               ` Rafael J. Wysocki
  1 sibling, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 21:36 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: david, Nigel Cunningham, linux-kernel, linux-acpi, Stefan Richter,
	Pavel Machek, Andrew Morton, Linus Torvalds, pm list

On Sunday, 29 July 2007 23:18, Adrian Bunk wrote:
> On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> > On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > > >...
> > > > +config SUSPEND
> > > > +	bool "Suspend"
> > >              "Suspend to RAM"
> > 
> > Not only.  This also includes "standby".
> 
> Whatever it includes - please tell it to the user in the prompt.
> 
> Technical issues are important, but it's often forgotten how many 
> problems people run into because the description of a kconfig option 
> could have been better.

Sure.  Please see the updated patch I've just sent. :-)

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]                 ` <1185744640.2295.4.camel@work>
@ 2007-07-29 22:22                   ` Rafael J. Wysocki
  2007-07-30  2:47                   ` Kyle Moffett
       [not found]                   ` <200707300022.54633.rjw@sisk.pl>
  2 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-29 22:22 UTC (permalink / raw)
  To: Richard Hughes
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds,
	pm list

On Sunday, 29 July 2007 23:30, Richard Hughes wrote:
> On Sun, 2007-07-29 at 23:36 +0200, Rafael J. Wysocki wrote:
> > On Sunday, 29 July 2007 23:18, Adrian Bunk wrote:
> > > On Sun, Jul 29, 2007 at 11:17:20PM +0200, Rafael J. Wysocki wrote:
> > > > On Sunday, 29 July 2007 22:40, Adrian Bunk wrote:
> > > > > On Sun, Jul 29, 2007 at 02:38:05PM +0200, Rafael J. Wysocki wrote:
> > > > > >...
> > > > > > +config SUSPEND
> > > > > > +	bool "Suspend"
> > > > >              "Suspend to RAM"
> > > > 
> > > > Not only.  This also includes "standby".
> > > 
> > > Whatever it includes - please tell it to the user in the prompt.
> > > 
> > > Technical issues are important, but it's often forgotten how many 
> > > problems people run into because the description of a kconfig option 
> > > could have been better.
> > 
> > Sure.  Please see the updated patch I've just sent. :-)
> 
> So are you guys using:
> 
> "standby" = idle state, ~0.5 seconds
> "suspend" = sleep to ram, ~10 seconds
> "hibernate" = sleep to disk, ~30 seconds

Something like this, but "suspend" is not reserved as a name of specific state.

The second state is usually referred to as "suspend to RAM" or "STR" and is
denoted by "mem" in /sys/power/state, if implemented.  Moreover, "standby" and
"mem" are both entered using the same code path, so they may generally be
referred to as "suspend" states.

The times aren't strictly defined for "mem" and "standby", too.  The general
rule is that the times for "mem" are greater then for "standby" and the power
drawn in "mem" is smaller than the power drawn in "standby", but the exact
values will always depend on the platform.  Apart from this, if the platform
supports only one "suspend" state, it decides if that's "mem" or "standby".

On ACPI systems "standby" and "mem" correspond to the S1 and S3 sleep states,
respectively.

Greetings,
Rafael
 

-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
       [not found]       ` <200707292323.29601.rjw@sisk.pl>
  2007-07-29 21:24         ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
  2007-07-29 21:27         ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
@ 2007-07-30  0:21         ` Linus Torvalds
  2007-07-30  7:25           ` Rafael J. Wysocki
                             ` (4 more replies)
       [not found]         ` <200707292327.19884.rjw@sisk.pl>
  3 siblings, 5 replies; 28+ messages in thread
From: Linus Torvalds @ 2007-07-30  0:21 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list



Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on 
top of it (I took the easy way out, and just made PM_SLEEP imply 
ACPI_SLEEP, which should make everything come out right. I could have 
dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have 
implied changing more of Len's patch than I was really comfy with).

Len, Rafael, please do check that the end result looks ok. 

I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into 
account, and that some of the code is not necessary when HIBERNATE is not 
selected, for example, but I'm not at all sure that it's worth it being 
very fine-grained.

		Linus

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]                 ` <1185744640.2295.4.camel@work>
  2007-07-29 22:22                   ` Rafael J. Wysocki
@ 2007-07-30  2:47                   ` Kyle Moffett
       [not found]                   ` <200707300022.54633.rjw@sisk.pl>
  2 siblings, 0 replies; 28+ messages in thread
From: Kyle Moffett @ 2007-07-30  2:47 UTC (permalink / raw)
  To: Richard Hughes
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds,
	pm list

On Jul 29, 2007, at 17:30:40, Richard Hughes wrote:
> So are you guys using:
>
> "standby" = idle state, ~0.5 seconds
> "suspend" = sleep to ram, ~10 seconds
> "hibernate" = sleep to disk, ~30 seconds
>
> If so - you rock. This is the common nomenclature I've been pushing  
> for
> a few months now in GNOME, KDE and general userspace. I've written  
> up a
> spec here:
> http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/ 
> sleep-names.html

Well, those times don't quite work for my PowerBook.  If we fixed  
suspend-to-RAM to reinitialize devices in parallel then it would  
easily hit 0.5 second transition times, but even now it's only at  
most 2 seconds.  Also once in a while I'll be too hasty plugging my  
USB devices and manage to hardlock one of the USB busses, but that's  
an isolated USB driver suspend issue.

And it's certainly not called "standby", because the box can  
literally remain asleep for 7 days on a full charge, versus about 5  
hours when just idle with wireless, backlight, and HDD off.

Cheers,
Kyle Moffett

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
  2007-07-30  0:21         ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
@ 2007-07-30  7:25           ` Rafael J. Wysocki
  2007-07-31  3:54           ` Len Brown
                             ` (3 subsequent siblings)
  4 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-30  7:25 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Andi Kleen, pm list

On Monday, 30 July 2007 02:21, Linus Torvalds wrote:
> 
> Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on 
> top of it (I took the easy way out, and just made PM_SLEEP imply 
> ACPI_SLEEP, which should make everything come out right. I could have 
> dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have 
> implied changing more of Len's patch than I was really comfy with).
> 
> Len, Rafael, please do check that the end result looks ok. 

I only found two really minor issues covered by the appended patch (on top of
the current -git).

> I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into 
> account, and that some of the code is not necessary when HIBERNATE is not 
> selected, for example, but I'm not at all sure that it's worth it being 
> very fine-grained.

Well, IMO, for now let's make sure everything works as is. :-)

Greetings,
Rafael


---
(1) I think it's better to use CONFIG_ACPI_SLEEP instead of CONFIG_PM_SLEEP in
    include/acpi/acpi_bus.h , too, for consistency.

(2) x86_64 defconfig is outdated

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86_64/defconfig   |    3 ---
 include/acpi/acpi_bus.h |    6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h	2007-07-30 07:58:48.000000000 +0200
+++ linux-2.6/include/acpi/acpi_bus.h	2007-07-30 08:25:32.000000000 +0200
@@ -366,16 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, 
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_ACPI_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
-#else /* !CONFIG_PM_SLEEP */
+#else /* !CONFIG_ACPI_SLEEP */
 static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
 {
 	if (p)
 		*p = ACPI_STATE_D0;
 	return ACPI_STATE_D3;
 }
-#endif /* !CONFIG_PM_SLEEP */
+#endif /* !CONFIG_ACPI_SLEEP */
 
 #endif				/* CONFIG_ACPI */
 
Index: linux-2.6/arch/x86_64/defconfig
===================================================================
--- linux-2.6.orig/arch/x86_64/defconfig	2007-07-30 07:58:48.000000000 +0200
+++ linux-2.6/arch/x86_64/defconfig	2007-07-30 08:27:27.000000000 +0200
@@ -207,9 +207,6 @@ CONFIG_SUSPEND_SMP=y
 # ACPI (Advanced Configuration and Power Interface) Support
 #
 CONFIG_ACPI=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_SLEEP_PROC_SLEEP=y
 CONFIG_ACPI_PROCFS=y
 CONFIG_ACPI_AC=y
 CONFIG_ACPI_BATTERY=y

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND
       [not found]                   ` <200707300022.54633.rjw@sisk.pl>
@ 2007-07-30 21:26                     ` Pavel Machek
  0 siblings, 0 replies; 28+ messages in thread
From: Pavel Machek @ 2007-07-30 21:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: david, Nigel Cunningham, Richard Hughes, linux-kernel,
	Adrian Bunk, linux-acpi, Stefan Richter, Andrew Morton,
	Linus Torvalds, pm list

Hi!

> > > > > Not only.  This also includes "standby".
> > > > 
> > > > Whatever it includes - please tell it to the user in the prompt.
> > > > 
> > > > Technical issues are important, but it's often forgotten how many 
> > > > problems people run into because the description of a kconfig option 
> > > > could have been better.
> > > 
> > > Sure.  Please see the updated patch I've just sent. :-)
> > 
> > So are you guys using:
> > 
> > "standby" = idle state, ~0.5 seconds
> > "suspend" = sleep to ram, ~10 seconds
> > "hibernate" = sleep to disk, ~30 seconds
> 
> Something like this, but "suspend" is not reserved as a name of specific state.
> 
> The second state is usually referred to as "suspend to RAM" or "STR" and is
> denoted by "mem" in /sys/power/state, if implemented.  Moreover, "standby" and
> "mem" are both entered using the same code path, so they may generally be
> referred to as "suspend" states.
> 
> The times aren't strictly defined for "mem" and "standby", too.  The general
> rule is that the times for "mem" are greater then for "standby" and the power
> drawn in "mem" is smaller than the power drawn in "standby", but the exact
> values will always depend on the platform.  Apart from this, if the platform
> supports only one "suspend" state, it decides if that's "mem" or "standby".
> 
> On ACPI systems "standby" and "mem" correspond to the S1 and S3 sleep states,
> respectively.

And I'd expect ~2seconds for both "standby" and "mem" on ACPI
system. ACPI S1 is just "for windows ME compatibility, do not use" --
it draws too much power, and is not really faster.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated)
  2007-07-30  0:21         ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
  2007-07-30  7:25           ` Rafael J. Wysocki
@ 2007-07-31  3:54           ` Len Brown
  2007-07-31  3:54           ` [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE Len Brown
                             ` (2 subsequent siblings)
  4 siblings, 0 replies; 28+ messages in thread
From: Len Brown @ 2007-07-31  3:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

On Sunday 29 July 2007 20:21, Linus Torvalds wrote:
> 
> Ok, I took this, and modified Len's patch to re-introduce ACPI_SLEEP on 
> top of it (I took the easy way out, and just made PM_SLEEP imply 
> ACPI_SLEEP, which should make everything come out right. I could have 
> dropped ACPI_SLEEP entirely in favour of PM_SLEEP, but that would have 
> implied changing more of Len's patch than I was really comfy with).
> 
> Len, Rafael, please do check that the end result looks ok. 

SUSPEND depends only on (!SMP || SUSPEND_SMP_POSSIBLE).
This means that while we limit the architectures it can build on
if they are SMP, it can build on any !SMP architecture --
which probably isn't what we want.

I think the right way to go is your SUSPEND_UP_POSSIBLE suggestion.
Honestly, I though it was overly verbose when I first read it,
but I like it better now, especially since it works;-)
I'll reply w/ an incremental patch.

> I suspect ACPI could now take the PM_SLEEP/SUSPEND/HIBERNATE details into 
> account, and that some of the code is not necessary when HIBERNATE is not 
> selected, for example, but I'm not at all sure that it's worth it being 
> very fine-grained.

As you know, I don't think that it is worth dedicated config options
to save 16KB on an SMP+ACPI kernel.  The prospect of adding code to
slice that 16KB into finer grain savings seems even less worthwhile.

-Len

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
  2007-07-30  0:21         ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
  2007-07-30  7:25           ` Rafael J. Wysocki
  2007-07-31  3:54           ` Len Brown
@ 2007-07-31  3:54           ` Len Brown
       [not found]           ` <200707302354.23237.lenb@kernel.org>
  2007-08-01  3:27           ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
  4 siblings, 0 replies; 28+ messages in thread
From: Len Brown @ 2007-07-31  3:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

From: Linus Torvalds <torvalds@linux-foundation.org>

Without this change, it is possible to build CONFIG_HIBERNATE
on all !SMP architectures, but not necessarily their SMP versions.

I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE
is correct.  For now it simply matches the list for SUSPEND_SMP_POSSIBLE.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 Kconfig |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 412859f..ccf6576 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -72,6 +72,11 @@ config PM_TRACE
 	CAUTION: this option will cause your machine's real-time clock to be
 	set to an invalid time after a resume.
 
+config SUSPEND_UP_POSSIBLE
+	bool
+	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+	default y
+
 config SUSPEND_SMP_POSSIBLE
 	bool
 	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
@@ -92,7 +97,7 @@ config PM_SLEEP
 config SUSPEND
 	bool "Suspend to RAM and standby"
 	depends on PM
-	depends on !SMP || SUSPEND_SMP_POSSIBLE
+	depends on (!SMP && SUSPEND_UP_POSSIBLE) || (SMP && SUSPEND_SMP_POSSIBLE)
 	default y
 	---help---
 	  Allow the system to enter sleep states in which main memory is

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
       [not found]         ` <200707292327.19884.rjw@sisk.pl>
@ 2007-07-31  4:59           ` Len Brown
  2007-07-31  9:15             ` Rafael J. Wysocki
       [not found]             ` <200707311115.29057.rjw@sisk.pl>
  0 siblings, 2 replies; 28+ messages in thread
From: Len Brown @ 2007-07-31  4:59 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds,
	pm list

On Sunday 29 July 2007 17:27, Rafael J. Wysocki wrote:
> Still, there are many other files in which CONFIG_PM can be replaced
> with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
> the future.

There is #ifdef CONFIG_PM
around all the .suspend and .resume methods.

Technically they are PM_DEVICE_STATES or something,
that could really be under PM, and both SUSPEND and HIBERNATE
would depend on PM_DEVICE_STATES, but it is also possible to have
PM_DEVICE_STATES without SUSPEND and HIBERNATE.

oh no, I just suggested more instead of fewer config options:-O

but i agree, this can wait a bit...

-Len

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
       [not found]           ` <200707302354.23237.lenb@kernel.org>
@ 2007-07-31  6:38             ` Pavel Machek
       [not found]             ` <20070731063833.GD22419@elf.ucw.cz>
  1 sibling, 0 replies; 28+ messages in thread
From: Pavel Machek @ 2007-07-31  6:38 UTC (permalink / raw)
  To: Len Brown
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Andrew Morton, Linus Torvalds, pm list

Hi!

> Without this change, it is possible to build CONFIG_HIBERNATE
> on all !SMP architectures, but not necessarily their SMP versions.

Did you want to say "CONFIG_SUSPEND"?

> I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE
> is correct.  For now it simply matches the list for
> SUSPEND_SMP_POSSIBLE.

I do not think it is.

> Signed-off-by: Len Brown <len.brown@intel.com>
> ---
>  Kconfig |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> index 412859f..ccf6576 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -72,6 +72,11 @@ config PM_TRACE
>  	CAUTION: this option will cause your machine's real-time clock to be
>  	set to an invalid time after a resume.
>  
> +config SUSPEND_UP_POSSIBLE
> +	bool
> +	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||

At least ARM can do suspend, too... probably others. I was under
impression that SUSPEND is "supported" by all the architectures, just
some of them veto it at runtime (using pm_ops or how was it renamed).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
  2007-07-31  4:59           ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Len Brown
@ 2007-07-31  9:15             ` Rafael J. Wysocki
       [not found]             ` <200707311115.29057.rjw@sisk.pl>
  1 sibling, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-31  9:15 UTC (permalink / raw)
  To: Len Brown
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds,
	pm list

On Tuesday, 31 July 2007 06:59, Len Brown wrote:
> On Sunday 29 July 2007 17:27, Rafael J. Wysocki wrote:
> > Still, there are many other files in which CONFIG_PM can be replaced
> > with CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
> > the future.
> 
> There is #ifdef CONFIG_PM
> around all the .suspend and .resume methods.
> 
> Technically they are PM_DEVICE_STATES or something,
> that could really be under PM, and both SUSPEND and HIBERNATE
> would depend on PM_DEVICE_STATES, but it is also possible to have
> PM_DEVICE_STATES without SUSPEND and HIBERNATE.

Well, the people on linux-pm seem to agree that the .suspend() and .resume()
callbacks are not suitable for runtime power management, so having them
built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

Greetings,
Rafael


-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
       [not found]             ` <200707311115.29057.rjw@sisk.pl>
@ 2007-07-31  9:16               ` Oliver Neukum
       [not found]               ` <200707311116.39857.oliver@neukum.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Oliver Neukum @ 2007-07-31  9:16 UTC (permalink / raw)
  To: linux-pm
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds

Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:

> Well, the people on linux-pm seem to agree that the .suspend() and .resume()
> callbacks are not suitable for runtime power management, so having them
> built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)

These are what USB runtime power management uses. How many code
paths for power management do you want to introduce?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
       [not found]             ` <20070731063833.GD22419@elf.ucw.cz>
@ 2007-07-31  9:33               ` Rafael J. Wysocki
  2007-08-03 19:23               ` Len Brown
       [not found]               ` <200708031523.19623.lenb@kernel.org>
  2 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-31  9:33 UTC (permalink / raw)
  To: Pavel Machek
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Andrew Morton, Linus Torvalds, pm list

On Tuesday, 31 July 2007 08:38, Pavel Machek wrote:
> Hi!
> 
> > Without this change, it is possible to build CONFIG_HIBERNATE
> > on all !SMP architectures, but not necessarily their SMP versions.
> 
> Did you want to say "CONFIG_SUSPEND"?
> 
> > I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE
> > is correct.  For now it simply matches the list for
> > SUSPEND_SMP_POSSIBLE.
> 
> I do not think it is.

No, it's not.

> > Signed-off-by: Len Brown <len.brown@intel.com>
> > ---
> >  Kconfig |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > index 412859f..ccf6576 100644
> > --- a/kernel/power/Kconfig
> > +++ b/kernel/power/Kconfig
> > @@ -72,6 +72,11 @@ config PM_TRACE
> >  	CAUTION: this option will cause your machine's real-time clock to be
> >  	set to an invalid time after a resume.
> >  
> > +config SUSPEND_UP_POSSIBLE
> > +	bool
> > +	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||
> 
> At least ARM can do suspend, too... probably others.

ARM, frv, sh, mips and blackfin (AFAICS).

> I was under impression that SUSPEND is "supported" by all the architectures,
> just some of them veto it at runtime (using pm_ops or how was it renamed).

Historically, suspend support was implied by CONFIG_PM.

For now, it's not much point in using CONFIG_PM at all if the arch in question
doesn't support suspending or hibernation, so I thought it would be better to
leave it unrestricted.

Greetings,
Rafael


-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Re: [PATCH 2/2] Introduce CONFIG_SUSPEND (updated)
       [not found]               ` <200707311116.39857.oliver@neukum.org>
@ 2007-07-31 10:01                 ` Rafael J. Wysocki
  0 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-07-31 10:01 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, linux-pm, Linus Torvalds,
	Andrew Morton

On Tuesday, 31 July 2007 11:16, Oliver Neukum wrote:
> Am Dienstag 31 Juli 2007 schrieb Rafael J. Wysocki:
> 
> > Well, the people on linux-pm seem to agree that the .suspend() and .resume()
> > callbacks are not suitable for runtime power management, so having them
> > built without SUSPEND or HIBERNATION wouldn't be very useful. ;-)
> 
> These are what USB runtime power management uses.

To be precise, I think the rule should be that if some code is needed for
anything else than suspend/hibernation, it should be under plain CONFIG_PM.
Still, if something is only needed for suspend/hibernation, it should go under
CONFIG_PM_SLEEP or CONFIG_SUSPEND/HIBERNATION, depending on what it's needed
for.

Now, AFAICS, for the majority of drivers .suspend() and .resume() are only
needed for suspend/hibernation and really should be used for suspending
only (some other callbacks are needed for hibernation).

> How many code paths for power management do you want to introduce?

At least one more, for hibernation.

That also depends on what approach to the runtime power management is widely
accepted.  For now, USB is in the vanguard. :-)

Greetings,
Rafael


-- 
"Premature optimization is the root of all evil." - Donald Knuth

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)
  2007-07-30  0:21         ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
                             ` (3 preceding siblings ...)
       [not found]           ` <200707302354.23237.lenb@kernel.org>
@ 2007-08-01  3:27           ` Len Brown
  2007-08-01 10:24             ` Rafael J. Wysocki
  4 siblings, 1 reply; 28+ messages in thread
From: Len Brown @ 2007-08-01  3:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, pm list

From: Len Brown <len.brown@intel.com>

CONFIG_ACPI_PROCFS_SLEEP is a NO-OP -- delete it (again).

Apparently 296699de6bdc717189a331ab6bbe90e05c94db06 creating CONFIG_SUSPEND
and CONFIG_PM_SLEEP was based on an out-dated version of drivers/acpi/Kconfig,
as it erroneously restored this recently deleted config option.

Signed-off-by: Len Brown <len.brown@intel.com>
---
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 934d639..f1372de 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -68,14 +68,6 @@ config ACPI_PROCFS
 
 	  Say N to delete /proc/acpi/ files that have moved to /sys/
 
-config ACPI_PROCFS_SLEEP
-	bool "/proc/acpi/sleep (deprecated)"
-	depends on PM_SLEEP && ACPI_PROCFS
-	default n
-	---help---
-	  Create /proc/acpi/sleep
-	  Deprecated by /sys/power/state
-
 config ACPI_AC
 	tristate "AC Adapter"
 	depends on X86

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again)
  2007-08-01  3:27           ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
@ 2007-08-01 10:24             ` Rafael J. Wysocki
  0 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2007-08-01 10:24 UTC (permalink / raw)
  To: Len Brown
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Pavel Machek, Andrew Morton, Linus Torvalds,
	pm list

On Wednesday, 1 August 2007 05:27, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> CONFIG_ACPI_PROCFS_SLEEP is a NO-OP -- delete it (again).
> 
> Apparently 296699de6bdc717189a331ab6bbe90e05c94db06 creating CONFIG_SUSPEND
> and CONFIG_PM_SLEEP was based on an out-dated version of drivers/acpi/Kconfig,
> as it erroneously restored this recently deleted config option.

Some chunks of code in drivers/acpi/sleep/proc.c depend on
CONFIG_ACPI_PROCFS_SLEEP.  Do you also intend to remove that code?

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
       [not found]             ` <20070731063833.GD22419@elf.ucw.cz>
  2007-07-31  9:33               ` Rafael J. Wysocki
@ 2007-08-03 19:23               ` Len Brown
       [not found]               ` <200708031523.19623.lenb@kernel.org>
  2 siblings, 0 replies; 28+ messages in thread
From: Len Brown @ 2007-08-03 19:23 UTC (permalink / raw)
  To: Pavel Machek
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Andrew Morton, Linus Torvalds, pm list

On Tuesday 31 July 2007 02:38, Pavel Machek wrote:
> Hi!
> 
> > Without this change, it is possible to build CONFIG_HIBERNATE
> > on all !SMP architectures, but not necessarily their SMP versions.
> 
> Did you want to say "CONFIG_SUSPEND"?

Yes.

> > I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE
> > is correct.  For now it simply matches the list for
> > SUSPEND_SMP_POSSIBLE.
> 
> I do not think it is.
> 
> > Signed-off-by: Len Brown <len.brown@intel.com>
> > ---
> >  Kconfig |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > index 412859f..ccf6576 100644
> > --- a/kernel/power/Kconfig
> > +++ b/kernel/power/Kconfig
> > @@ -72,6 +72,11 @@ config PM_TRACE
> >  	CAUTION: this option will cause your machine's real-time clock to be
> >  	set to an invalid time after a resume.
> >  
> > +config SUSPEND_UP_POSSIBLE
> > +	bool
> > +	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||
> 
> At least ARM can do suspend, too... probably others. I was under
> impression that SUSPEND is "supported" by all the architectures, just
> some of them veto it at runtime (using pm_ops or how was it renamed).

The reason this entire thread started is because Linus, Jeff and others
said that they didn't want code magically compiled into their kernel
that they did not explicitly ask for -- even if the savings were small
and that kernel was already something rather beefy, such as ACPI+SMP.

The current code is simply broken, because it allows SUSPEND
on IA64 if UP, but not on SMP.  It should really be neither.

Further, the only requirement to enable CONFIG_SUSPEND by default
is PM && CONFIG_SMP=n, and that doesn't make much sense -- particularly
since many of the non X86 architectures are small and according
to the logic above, if SUSPEND (and PM_SLEEP, which it enables)
adds any code to those kernels when they don't need it,
then it would be a regression.

thus my patch, if there is a list for SMP, there should
be a list for !SMP.  If the list is incomplete, we need to fix it.
 
-Len

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE
       [not found]               ` <200708031523.19623.lenb@kernel.org>
@ 2007-08-05 18:36                 ` Pavel Machek
  0 siblings, 0 replies; 28+ messages in thread
From: Pavel Machek @ 2007-08-05 18:36 UTC (permalink / raw)
  To: Len Brown
  Cc: david, Nigel Cunningham, linux-kernel, Adrian Bunk, linux-acpi,
	Stefan Richter, Andrew Morton, Linus Torvalds, pm list

On Fri 2007-08-03 15:23:19, Len Brown wrote:
> On Tuesday 31 July 2007 02:38, Pavel Machek wrote:
> > Hi!
> > 
> > > Without this change, it is possible to build CONFIG_HIBERNATE
> > > on all !SMP architectures, but not necessarily their SMP versions.
> > 
> > Did you want to say "CONFIG_SUSPEND"?
> 
> Yes.
> 
> > > I don't know for sure if the architecture list under SUSPEND_UP_POSSIBLE
> > > is correct.  For now it simply matches the list for
> > > SUSPEND_SMP_POSSIBLE.
> > 
> > I do not think it is.
> > 
> > > Signed-off-by: Len Brown <len.brown@intel.com>
> > > ---
> > >  Kconfig |    7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> > > index 412859f..ccf6576 100644
> > > --- a/kernel/power/Kconfig
> > > +++ b/kernel/power/Kconfig
> > > @@ -72,6 +72,11 @@ config PM_TRACE
> > >  	CAUTION: this option will cause your machine's real-time clock to be
> > >  	set to an invalid time after a resume.
> > >  
> > > +config SUSPEND_UP_POSSIBLE
> > > +	bool
> > > +	depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES ||
> > 
> > At least ARM can do suspend, too... probably others. I was under
> > impression that SUSPEND is "supported" by all the architectures, just
> > some of them veto it at runtime (using pm_ops or how was it renamed).
> 
> The reason this entire thread started is because Linus, Jeff and others
> said that they didn't want code magically compiled into their kernel
> that they did not explicitly ask for -- even if the savings were small
> and that kernel was already something rather beefy, such as ACPI+SMP.
> 
> The current code is simply broken, because it allows SUSPEND
> on IA64 if UP, but not on SMP.  It should really be neither.

Actually, it should be both, AFAICT. Suspend infrastructure should be
there, just returing -EINVAL... that's how it worked in 2.6.22 IIRC.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2007-08-05 18:36 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200707251238.50218.lenb@kernel.org>
     [not found] ` <200707282029.03563.rjw@sisk.pl>
     [not found]   ` <alpine.LFD.0.999.0707281130110.3442@woody.linux-foundation.org>
2007-07-29 10:20     ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (was: CONFIG_SUSPEND?) Rafael J. Wysocki
     [not found]     ` <200707291220.14880.rjw@sisk.pl>
2007-07-29 10:21       ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION Rafael J. Wysocki
2007-07-29 12:38       ` [PATCH 2/2] Introduce CONFIG_SUSPEND Rafael J. Wysocki
     [not found]       ` <200707291438.06849.rjw@sisk.pl>
2007-07-29 20:40         ` Adrian Bunk
     [not found]         ` <20070729204001.GJ16817@stusta.de>
2007-07-29 21:17           ` Rafael J. Wysocki
     [not found]           ` <200707292317.21419.rjw@sisk.pl>
2007-07-29 21:18             ` Adrian Bunk
     [not found]             ` <20070729211824.GL16817@stusta.de>
     [not found]               ` <200707292336.55588.rjw@sisk.pl>
2007-07-29 21:30                 ` Richard Hughes
     [not found]                 ` <1185744640.2295.4.camel@work>
2007-07-29 22:22                   ` Rafael J. Wysocki
2007-07-30  2:47                   ` Kyle Moffett
     [not found]                   ` <200707300022.54633.rjw@sisk.pl>
2007-07-30 21:26                     ` Pavel Machek
2007-07-29 21:36               ` Rafael J. Wysocki
2007-07-29 21:23       ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and CONFIG_SUSPEND (updated) Rafael J. Wysocki
     [not found]       ` <200707292323.29601.rjw@sisk.pl>
2007-07-29 21:24         ` [PATCH 1/2] Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION (updated) Rafael J. Wysocki
2007-07-29 21:27         ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Rafael J. Wysocki
2007-07-30  0:21         ` [PATCH 0/2] Introduce CONFIG_HIBERNATION and " Linus Torvalds
2007-07-30  7:25           ` Rafael J. Wysocki
2007-07-31  3:54           ` Len Brown
2007-07-31  3:54           ` [PATCH] create CONFIG_SUSPEND_UP_POSSIBLE Len Brown
     [not found]           ` <200707302354.23237.lenb@kernel.org>
2007-07-31  6:38             ` Pavel Machek
     [not found]             ` <20070731063833.GD22419@elf.ucw.cz>
2007-07-31  9:33               ` Rafael J. Wysocki
2007-08-03 19:23               ` Len Brown
     [not found]               ` <200708031523.19623.lenb@kernel.org>
2007-08-05 18:36                 ` Pavel Machek
2007-08-01  3:27           ` [PATCH] ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) Len Brown
2007-08-01 10:24             ` Rafael J. Wysocki
     [not found]         ` <200707292327.19884.rjw@sisk.pl>
2007-07-31  4:59           ` [PATCH 2/2] Introduce CONFIG_SUSPEND (updated) Len Brown
2007-07-31  9:15             ` Rafael J. Wysocki
     [not found]             ` <200707311115.29057.rjw@sisk.pl>
2007-07-31  9:16               ` Oliver Neukum
     [not found]               ` <200707311116.39857.oliver@neukum.org>
2007-07-31 10:01                 ` 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