[PATCH] swsusp: Fix labels
[pandora-kernel.git] / kernel / power / user.c
index a63b25c..069732e 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/fs.h>
 #include <linux/console.h>
 #include <linux/cpu.h>
+#include <linux/freezer.h>
 
 #include <asm/uaccess.h>
 
@@ -78,10 +79,10 @@ static int snapshot_release(struct inode *inode, struct file *filp)
        free_all_swap_pages(data->swap, data->bitmap);
        free_bitmap(data->bitmap);
        if (data->frozen) {
-               down(&pm_sem);
+               mutex_lock(&pm_mutex);
                thaw_processes();
                enable_nonboot_cpus();
-               up(&pm_sem);
+               mutex_unlock(&pm_mutex);
        }
        atomic_inc(&device_available);
        return 0;
@@ -143,7 +144,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
        case SNAPSHOT_FREEZE:
                if (data->frozen)
                        break;
-               down(&pm_sem);
+               mutex_lock(&pm_mutex);
                error = disable_nonboot_cpus();
                if (!error) {
                        error = freeze_processes();
@@ -153,7 +154,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                                error = -EBUSY;
                        }
                }
-               up(&pm_sem);
+               mutex_unlock(&pm_mutex);
                if (!error)
                        data->frozen = 1;
                break;
@@ -161,10 +162,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
        case SNAPSHOT_UNFREEZE:
                if (!data->frozen)
                        break;
-               down(&pm_sem);
+               mutex_lock(&pm_mutex);
                thaw_processes();
                enable_nonboot_cpus();
-               up(&pm_sem);
+               mutex_unlock(&pm_mutex);
                data->frozen = 0;
                break;
 
@@ -173,7 +174,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                        error = -EPERM;
                        break;
                }
-               down(&pm_sem);
+               mutex_lock(&pm_mutex);
                /* Free memory before shutting down devices. */
                error = swsusp_shrink_memory();
                if (!error) {
@@ -186,7 +187,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                        }
                        resume_console();
                }
-               up(&pm_sem);
+               mutex_unlock(&pm_mutex);
                if (!error)
                        error = put_user(in_suspend, (unsigned int __user *)arg);
                if (!error)
@@ -200,7 +201,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                        error = -EPERM;
                        break;
                }
-               down(&pm_sem);
+               mutex_lock(&pm_mutex);
                pm_prepare_console();
                suspend_console();
                error = device_suspend(PMSG_PRETHAW);
@@ -210,7 +211,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                }
                resume_console();
                pm_restore_console();
-               up(&pm_sem);
+               mutex_unlock(&pm_mutex);
                break;
 
        case SNAPSHOT_FREE:
@@ -285,7 +286,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                        break;
                }
 
-               if (down_trylock(&pm_sem)) {
+               if (!mutex_trylock(&pm_mutex)) {
                        error = -EBUSY;
                        break;
                }
@@ -312,8 +313,8 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                if (pm_ops->finish)
                        pm_ops->finish(PM_SUSPEND_MEM);
 
-OutS3:
-               up(&pm_sem);
+ OutS3:
+               mutex_unlock(&pm_mutex);
                break;
 
        case SNAPSHOT_PMOPS: