aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2008-02-06 04:36:25 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:01 -0500
commit0a5dcb51770be3cd0202d6b90a07996fb40130b6 (patch)
tree75ac6d5c64be71369126e8ad05b62b59576df4e7
parent8f47f0b688bba7642dac4e979896e4692177670b (diff)
Parallel port: convert port_mutex to the mutex API
Parallel port: Convert port_mutex to the mutex API [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/lp.c10
-rw-r--r--include/linux/lp.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 81674d7c56c7..60ac642752be 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -312,7 +312,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf,
312 if (copy_size > LP_BUFFER_SIZE) 312 if (copy_size > LP_BUFFER_SIZE)
313 copy_size = LP_BUFFER_SIZE; 313 copy_size = LP_BUFFER_SIZE;
314 314
315 if (down_interruptible (&lp_table[minor].port_mutex)) 315 if (mutex_lock_interruptible(&lp_table[minor].port_mutex))
316 return -EINTR; 316 return -EINTR;
317 317
318 if (copy_from_user (kbuf, buf, copy_size)) { 318 if (copy_from_user (kbuf, buf, copy_size)) {
@@ -399,7 +399,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf,
399 lp_release_parport (&lp_table[minor]); 399 lp_release_parport (&lp_table[minor]);
400 } 400 }
401out_unlock: 401out_unlock:
402 up (&lp_table[minor].port_mutex); 402 mutex_unlock(&lp_table[minor].port_mutex);
403 403
404 return retv; 404 return retv;
405} 405}
@@ -421,7 +421,7 @@ static ssize_t lp_read(struct file * file, char __user * buf,
421 if (count > LP_BUFFER_SIZE) 421 if (count > LP_BUFFER_SIZE)
422 count = LP_BUFFER_SIZE; 422 count = LP_BUFFER_SIZE;
423 423
424 if (down_interruptible (&lp_table[minor].port_mutex)) 424 if (mutex_lock_interruptible(&lp_table[minor].port_mutex))
425 return -EINTR; 425 return -EINTR;
426 426
427 lp_claim_parport_or_block (&lp_table[minor]); 427 lp_claim_parport_or_block (&lp_table[minor]);
@@ -479,7 +479,7 @@ static ssize_t lp_read(struct file * file, char __user * buf,
479 if (retval > 0 && copy_to_user (buf, kbuf, retval)) 479 if (retval > 0 && copy_to_user (buf, kbuf, retval))
480 retval = -EFAULT; 480 retval = -EFAULT;
481 481
482 up (&lp_table[minor].port_mutex); 482 mutex_unlock(&lp_table[minor].port_mutex);
483 483
484 return retval; 484 return retval;
485} 485}
@@ -888,7 +888,7 @@ static int __init lp_init (void)
888 lp_table[i].last_error = 0; 888 lp_table[i].last_error = 0;
889 init_waitqueue_head (&lp_table[i].waitq); 889 init_waitqueue_head (&lp_table[i].waitq);
890 init_waitqueue_head (&lp_table[i].dataq); 890 init_waitqueue_head (&lp_table[i].dataq);
891 init_MUTEX (&lp_table[i].port_mutex); 891 mutex_init(&lp_table[i].port_mutex);
892 lp_table[i].timeout = 10 * HZ; 892 lp_table[i].timeout = 10 * HZ;
893 } 893 }
894 894
diff --git a/include/linux/lp.h b/include/linux/lp.h
index 7059b6b9878a..0df024bfd6f0 100644
--- a/include/linux/lp.h
+++ b/include/linux/lp.h
@@ -99,7 +99,7 @@
99#ifdef __KERNEL__ 99#ifdef __KERNEL__
100 100
101#include <linux/wait.h> 101#include <linux/wait.h>
102#include <asm/semaphore.h> 102#include <linux/mutex.h>
103 103
104/* Magic numbers for defining port-device mappings */ 104/* Magic numbers for defining port-device mappings */
105#define LP_PARPORT_UNSPEC -4 105#define LP_PARPORT_UNSPEC -4
@@ -145,7 +145,7 @@ struct lp_struct {
145#endif 145#endif
146 wait_queue_head_t waitq; 146 wait_queue_head_t waitq;
147 unsigned int last_error; 147 unsigned int last_error;
148 struct semaphore port_mutex; 148 struct mutex port_mutex;
149 wait_queue_head_t dataq; 149 wait_queue_head_t dataq;
150 long timeout; 150 long timeout;
151 unsigned int best_mode; 151 unsigned int best_mode;