Merge branch 'for-rmk' of git://linux-arm.org/linux-2.6 into devel
[sfrench/cifs-2.6.git] / kernel / power / disk.c
index e71ca9cd81b283ac408c82bd9b97c39aea0b09bc..5cb080e7eebd9a388d31a12425283c6b768a6e59 100644 (file)
@@ -215,8 +215,6 @@ static int create_image(int platform_mode)
        if (error)
                return error;
 
-       device_pm_lock();
-
        /* At this point, device_suspend() has been called, but *not*
         * device_power_down(). We *must* call device_power_down() now.
         * Otherwise, drivers for some devices (e.g. interrupt controllers)
@@ -227,7 +225,7 @@ static int create_image(int platform_mode)
        if (error) {
                printk(KERN_ERR "PM: Some devices failed to power down, "
                        "aborting hibernation\n");
-               goto Unlock;
+               return error;
        }
 
        error = platform_pre_snapshot(platform_mode);
@@ -241,9 +239,9 @@ static int create_image(int platform_mode)
 
        local_irq_disable();
 
-       sysdev_suspend(PMSG_FREEZE);
+       error = sysdev_suspend(PMSG_FREEZE);
        if (error) {
-               printk(KERN_ERR "PM: Some devices failed to power down, "
+               printk(KERN_ERR "PM: Some system devices failed to power down, "
                        "aborting hibernation\n");
                goto Enable_irqs;
        }
@@ -280,9 +278,6 @@ static int create_image(int platform_mode)
        device_power_up(in_suspend ?
                (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
 
- Unlock:
-       device_pm_unlock();
-
        return error;
 }
 
@@ -344,13 +339,11 @@ static int resume_target_kernel(bool platform_mode)
 {
        int error;
 
-       device_pm_lock();
-
        error = device_power_down(PMSG_QUIESCE);
        if (error) {
                printk(KERN_ERR "PM: Some devices failed to power down, "
                        "aborting resume\n");
-               goto Unlock;
+               return error;
        }
 
        error = platform_pre_restore(platform_mode);
@@ -403,9 +396,6 @@ static int resume_target_kernel(bool platform_mode)
 
        device_power_up(PMSG_RECOVER);
 
- Unlock:
-       device_pm_unlock();
-
        return error;
 }
 
@@ -464,11 +454,9 @@ int hibernation_platform_enter(void)
                goto Resume_devices;
        }
 
-       device_pm_lock();
-
        error = device_power_down(PMSG_HIBERNATE);
        if (error)
-               goto Unlock;
+               goto Resume_devices;
 
        error = hibernation_ops->prepare();
        if (error)
@@ -493,9 +481,6 @@ int hibernation_platform_enter(void)
 
        device_power_up(PMSG_RESTORE);
 
- Unlock:
-       device_pm_unlock();
-
  Resume_devices:
        entering_platform_hibernation = false;
        device_resume(PMSG_RESTORE);