aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vc_screen.c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-05-08 03:39:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:33 -0400
commitc831c338f0ad299fcd1592c6e4f30657480f39af (patch)
treee2562fbcffe80e9d78255a92aab7f7db1f761e9d /drivers/char/vc_screen.c
parent159dde93692ef549a0b2012c9f25feb4df638c9c (diff)
use mutex instead of semaphore in virtual console driver
The virtual console driver uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/vc_screen.c')
-rw-r--r--drivers/char/vc_screen.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index 61fbc9e52eeb..83aeedda200c 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -28,11 +28,13 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/mutex.h>
31#include <linux/vt_kern.h> 32#include <linux/vt_kern.h>
32#include <linux/selection.h> 33#include <linux/selection.h>
33#include <linux/kbd_kern.h> 34#include <linux/kbd_kern.h>
34#include <linux/console.h> 35#include <linux/console.h>
35#include <linux/device.h> 36#include <linux/device.h>
37
36#include <asm/uaccess.h> 38#include <asm/uaccess.h>
37#include <asm/byteorder.h> 39#include <asm/byteorder.h>
38#include <asm/unaligned.h> 40#include <asm/unaligned.h>
@@ -69,11 +71,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
69{ 71{
70 int size; 72 int size;
71 73
72 down(&con_buf_sem); 74 mutex_lock(&con_buf_mtx);
73 size = vcs_size(file->f_path.dentry->d_inode); 75 size = vcs_size(file->f_path.dentry->d_inode);
74 switch (orig) { 76 switch (orig) {
75 default: 77 default:
76 up(&con_buf_sem); 78 mutex_unlock(&con_buf_mtx);
77 return -EINVAL; 79 return -EINVAL;
78 case 2: 80 case 2:
79 offset += size; 81 offset += size;
@@ -84,11 +86,11 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
84 break; 86 break;
85 } 87 }
86 if (offset < 0 || offset > size) { 88 if (offset < 0 || offset > size) {
87 up(&con_buf_sem); 89 mutex_unlock(&con_buf_mtx);
88 return -EINVAL; 90 return -EINVAL;
89 } 91 }
90 file->f_pos = offset; 92 file->f_pos = offset;
91 up(&con_buf_sem); 93 mutex_unlock(&con_buf_mtx);
92 return file->f_pos; 94 return file->f_pos;
93} 95}
94 96
@@ -105,7 +107,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
105 unsigned short *org = NULL; 107 unsigned short *org = NULL;
106 ssize_t ret; 108 ssize_t ret;
107 109
108 down(&con_buf_sem); 110 mutex_lock(&con_buf_mtx);
109 111
110 pos = *ppos; 112 pos = *ppos;
111 113
@@ -262,7 +264,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
262 ret = read; 264 ret = read;
263unlock_out: 265unlock_out:
264 release_console_sem(); 266 release_console_sem();
265 up(&con_buf_sem); 267 mutex_unlock(&con_buf_mtx);
266 return ret; 268 return ret;
267} 269}
268 270
@@ -279,7 +281,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
279 u16 *org0 = NULL, *org = NULL; 281 u16 *org0 = NULL, *org = NULL;
280 size_t ret; 282 size_t ret;
281 283
282 down(&con_buf_sem); 284 mutex_lock(&con_buf_mtx);
283 285
284 pos = *ppos; 286 pos = *ppos;
285 287
@@ -449,7 +451,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
449unlock_out: 451unlock_out:
450 release_console_sem(); 452 release_console_sem();
451 453
452 up(&con_buf_sem); 454 mutex_unlock(&con_buf_mtx);
453 455
454 return ret; 456 return ret;
455} 457}