From 0cf151910ffc55f6104cddd4ea093e8e1346760a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 6 Dec 2006 20:34:21 -0800 Subject: [PATCH] --- yaml --- r: 42718 b: refs/heads/master c: 8a05aac2631aa0e6494d9dc990f8c68ed8b8fde7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/power/disk.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 845e1ef996e7..8ce2381ae25a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 859491218770315ba95ee3fa09961fc71c506cae +refs/heads/master: 8a05aac2631aa0e6494d9dc990f8c68ed8b8fde7 diff --git a/trunk/kernel/power/disk.c b/trunk/kernel/power/disk.c index d79feeb45459..f5079231383e 100644 --- a/trunk/kernel/power/disk.c +++ b/trunk/kernel/power/disk.c @@ -29,6 +29,22 @@ char resume_file[256] = CONFIG_PM_STD_PARTITION; dev_t swsusp_resume_device; sector_t swsusp_resume_block; +/** + * platform_prepare - prepare the machine for hibernation using the + * platform driver if so configured and return an error code if it fails + */ + +static inline int platform_prepare(void) +{ + int error = 0; + + if (pm_disk_mode == PM_DISK_PLATFORM) { + if (pm_ops && pm_ops->prepare) + error = pm_ops->prepare(PM_SUSPEND_DISK); + } + return error; +} + /** * power_down - Shut machine down for hibernate. * @mode: Suspend-to-disk mode @@ -91,9 +107,15 @@ static int prepare_processes(void) goto thaw; } + error = platform_prepare(); + if (error) + goto thaw; + /* Free memory before shutting down devices. */ if (!(error = swsusp_shrink_memory())) return 0; + + platform_finish(); thaw: thaw_processes(); enable_cpus: