Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rafael/suspend-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  fix XEN_SAVE_RESTORE Kconfig dependencies
  PM / Hibernate: Introduce CONFIG_HIBERNATE_CALLBACKS
  • Loading branch information
Linus Torvalds committed Apr 13, 2011
2 parents 6faf9a5 + d419e4c commit aaa119a
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions arch/powerpc/kernel/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static int ibmebus_bus_pm_resume_noirq(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int ibmebus_bus_pm_freeze(struct device *dev)
{
Expand Down Expand Up @@ -665,7 +665,7 @@ static int ibmebus_bus_pm_restore_noirq(struct device *dev)
return ret;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define ibmebus_bus_pm_freeze NULL
#define ibmebus_bus_pm_thaw NULL
Expand All @@ -676,7 +676,7 @@ static int ibmebus_bus_pm_restore_noirq(struct device *dev)
#define ibmebus_bus_pm_poweroff_noirq NULL
#define ibmebus_bus_pm_restore_noirq NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
.prepare = ibmebus_bus_pm_prepare,
Expand Down
1 change: 1 addition & 0 deletions arch/x86/xen/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ config XEN_MAX_DOMAIN_MEMORY
config XEN_SAVE_RESTORE
bool
depends on XEN
select HIBERNATE_CALLBACKS
default y

config XEN_DEBUG_FS
Expand Down
6 changes: 3 additions & 3 deletions drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static int amba_pm_resume_noirq(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int amba_pm_freeze(struct device *dev)
{
Expand Down Expand Up @@ -352,7 +352,7 @@ static int amba_pm_restore_noirq(struct device *dev)
return ret;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define amba_pm_freeze NULL
#define amba_pm_thaw NULL
Expand All @@ -363,7 +363,7 @@ static int amba_pm_restore_noirq(struct device *dev)
#define amba_pm_poweroff_noirq NULL
#define amba_pm_restore_noirq NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM

Expand Down
6 changes: 3 additions & 3 deletions drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ int __weak platform_pm_resume_noirq(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int platform_pm_freeze(struct device *dev)
{
Expand Down Expand Up @@ -910,7 +910,7 @@ static int platform_pm_restore_noirq(struct device *dev)
return ret;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define platform_pm_freeze NULL
#define platform_pm_thaw NULL
Expand All @@ -921,7 +921,7 @@ static int platform_pm_restore_noirq(struct device *dev)
#define platform_pm_poweroff_noirq NULL
#define platform_pm_restore_noirq NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM_RUNTIME

Expand Down
8 changes: 4 additions & 4 deletions drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static int pm_op(struct device *dev,
}
break;
#endif /* CONFIG_SUSPEND */
#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS
case PM_EVENT_FREEZE:
case PM_EVENT_QUIESCE:
if (ops->freeze) {
Expand All @@ -260,7 +260,7 @@ static int pm_op(struct device *dev,
suspend_report_result(ops->restore, error);
}
break;
#endif /* CONFIG_HIBERNATION */
#endif /* CONFIG_HIBERNATE_CALLBACKS */
default:
error = -EINVAL;
}
Expand Down Expand Up @@ -308,7 +308,7 @@ static int pm_noirq_op(struct device *dev,
}
break;
#endif /* CONFIG_SUSPEND */
#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS
case PM_EVENT_FREEZE:
case PM_EVENT_QUIESCE:
if (ops->freeze_noirq) {
Expand All @@ -335,7 +335,7 @@ static int pm_noirq_op(struct device *dev,
suspend_report_result(ops->restore_noirq, error);
}
break;
#endif /* CONFIG_HIBERNATION */
#endif /* CONFIG_HIBERNATE_CALLBACKS */
default:
error = -EINVAL;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ static int pci_pm_resume(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int pci_pm_freeze(struct device *dev)
{
Expand Down Expand Up @@ -970,7 +970,7 @@ static int pci_pm_restore(struct device *dev)
return error;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define pci_pm_freeze NULL
#define pci_pm_freeze_noirq NULL
Expand All @@ -981,7 +981,7 @@ static int pci_pm_restore(struct device *dev)
#define pci_pm_restore NULL
#define pci_pm_restore_noirq NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM_RUNTIME

Expand Down
6 changes: 3 additions & 3 deletions drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled)
xen_mm_unpin_all();
}

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS
static int xen_suspend(void *data)
{
struct suspend_info *si = data;
Expand Down Expand Up @@ -173,7 +173,7 @@ static void do_suspend(void)
#endif
shutting_down = SHUTDOWN_INVALID;
}
#endif /* CONFIG_HIBERNATION */
#endif /* CONFIG_HIBERNATE_CALLBACKS */

struct shutdown_handler {
const char *command;
Expand Down Expand Up @@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
{ "poweroff", do_poweroff },
{ "halt", do_poweroff },
{ "reboot", do_reboot },
#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS
{ "suspend", do_suspend },
#endif
{NULL, NULL},
Expand Down
11 changes: 3 additions & 8 deletions include/linux/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
extern int hibernate(void);
extern bool system_entering_hibernation(void);
#else /* CONFIG_HIBERNATION */
static inline void register_nosave_region(unsigned long b, unsigned long e) {}
static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
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) {}
Expand Down Expand Up @@ -297,14 +299,7 @@ static inline bool pm_wakeup_pending(void) { return false; }

extern struct mutex pm_mutex;

#ifndef CONFIG_HIBERNATION
static inline void register_nosave_region(unsigned long b, unsigned long e)
{
}
static inline void register_nosave_region_late(unsigned long b, unsigned long e)
{
}

#ifndef CONFIG_HIBERNATE_CALLBACKS
static inline void lock_system_sleep(void) {}
static inline void unlock_system_sleep(void) {}

Expand Down
6 changes: 5 additions & 1 deletion kernel/power/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ config SUSPEND_FREEZER

Turning OFF this setting is NOT recommended! If in doubt, say Y.

config HIBERNATE_CALLBACKS
bool

config HIBERNATION
bool "Hibernation (aka 'suspend to disk')"
depends on SWAP && ARCH_HIBERNATION_POSSIBLE
select HIBERNATE_CALLBACKS
select LZO_COMPRESS
select LZO_DECOMPRESS
---help---
Expand Down Expand Up @@ -85,7 +89,7 @@ config PM_STD_PARTITION

config PM_SLEEP
def_bool y
depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE
depends on SUSPEND || HIBERNATE_CALLBACKS

config PM_SLEEP_SMP
def_bool y
Expand Down

0 comments on commit aaa119a

Please sign in to comment.