Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-drm-fsl-dcu.git] / drivers / char / vc_screen.c
index f442b574b44ad00e40d5e08c570197c1deace7c6..83aeedda200cfccc6724be4eaf8ce3c715b1c2d7 100644 (file)
 #include <linux/major.h>
 #include <linux/errno.h>
 #include <linux/tty.h>
-#include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/mutex.h>
 #include <linux/vt_kern.h>
 #include <linux/selection.h>
 #include <linux/kbd_kern.h>
 #include <linux/console.h>
-#include <linux/smp_lock.h>
 #include <linux/device.h>
+
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
@@ -71,11 +71,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
 {
        int size;
 
-       down(&con_buf_sem);
-       size = vcs_size(file->f_dentry->d_inode);
+       mutex_lock(&con_buf_mtx);
+       size = vcs_size(file->f_path.dentry->d_inode);
        switch (orig) {
                default:
-                       up(&con_buf_sem);
+                       mutex_unlock(&con_buf_mtx);
                        return -EINVAL;
                case 2:
                        offset += size;
@@ -86,11 +86,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
                        break;
        }
        if (offset < 0 || offset > size) {
-               up(&con_buf_sem);
+               mutex_unlock(&con_buf_mtx);
                return -EINVAL;
        }
        file->f_pos = offset;
-       up(&con_buf_sem);
+       mutex_unlock(&con_buf_mtx);
        return file->f_pos;
 }
 
@@ -98,7 +98,7 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
 static ssize_t
 vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
        unsigned int currcons = iminor(inode);
        struct vc_data *vc;
        long pos;
@@ -107,7 +107,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
        unsigned short *org = NULL;
        ssize_t ret;
 
-       down(&con_buf_sem);
+       mutex_lock(&con_buf_mtx);
 
        pos = *ppos;
 
@@ -264,14 +264,14 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
                ret = read;
 unlock_out:
        release_console_sem();
-       up(&con_buf_sem);
+       mutex_unlock(&con_buf_mtx);
        return ret;
 }
 
 static ssize_t
 vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
        unsigned int currcons = iminor(inode);
        struct vc_data *vc;
        long pos;
@@ -281,7 +281,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
        u16 *org0 = NULL, *org = NULL;
        size_t ret;
 
-       down(&con_buf_sem);
+       mutex_lock(&con_buf_mtx);
 
        pos = *ppos;
 
@@ -451,7 +451,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 unlock_out:
        release_console_sem();
 
-       up(&con_buf_sem);
+       mutex_unlock(&con_buf_mtx);
 
        return ret;
 }