Commit 0a5dcb51 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Linus Torvalds

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: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8f47f0b6
...@@ -312,7 +312,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf, ...@@ -312,7 +312,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf,
if (copy_size > LP_BUFFER_SIZE) if (copy_size > LP_BUFFER_SIZE)
copy_size = LP_BUFFER_SIZE; copy_size = LP_BUFFER_SIZE;
if (down_interruptible (&lp_table[minor].port_mutex)) if (mutex_lock_interruptible(&lp_table[minor].port_mutex))
return -EINTR; return -EINTR;
if (copy_from_user (kbuf, buf, copy_size)) { 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,7 +399,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf,
lp_release_parport (&lp_table[minor]); lp_release_parport (&lp_table[minor]);
} }
out_unlock: out_unlock:
up (&lp_table[minor].port_mutex); mutex_unlock(&lp_table[minor].port_mutex);
return retv; return retv;
} }
...@@ -421,7 +421,7 @@ static ssize_t lp_read(struct file * file, char __user * buf, ...@@ -421,7 +421,7 @@ static ssize_t lp_read(struct file * file, char __user * buf,
if (count > LP_BUFFER_SIZE) if (count > LP_BUFFER_SIZE)
count = LP_BUFFER_SIZE; count = LP_BUFFER_SIZE;
if (down_interruptible (&lp_table[minor].port_mutex)) if (mutex_lock_interruptible(&lp_table[minor].port_mutex))
return -EINTR; return -EINTR;
lp_claim_parport_or_block (&lp_table[minor]); lp_claim_parport_or_block (&lp_table[minor]);
...@@ -479,7 +479,7 @@ static ssize_t lp_read(struct file * file, char __user * buf, ...@@ -479,7 +479,7 @@ static ssize_t lp_read(struct file * file, char __user * buf,
if (retval > 0 && copy_to_user (buf, kbuf, retval)) if (retval > 0 && copy_to_user (buf, kbuf, retval))
retval = -EFAULT; retval = -EFAULT;
up (&lp_table[minor].port_mutex); mutex_unlock(&lp_table[minor].port_mutex);
return retval; return retval;
} }
...@@ -888,7 +888,7 @@ static int __init lp_init (void) ...@@ -888,7 +888,7 @@ static int __init lp_init (void)
lp_table[i].last_error = 0; lp_table[i].last_error = 0;
init_waitqueue_head (&lp_table[i].waitq); init_waitqueue_head (&lp_table[i].waitq);
init_waitqueue_head (&lp_table[i].dataq); init_waitqueue_head (&lp_table[i].dataq);
init_MUTEX (&lp_table[i].port_mutex); mutex_init(&lp_table[i].port_mutex);
lp_table[i].timeout = 10 * HZ; lp_table[i].timeout = 10 * HZ;
} }
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/wait.h> #include <linux/wait.h>
#include <asm/semaphore.h> #include <linux/mutex.h>
/* Magic numbers for defining port-device mappings */ /* Magic numbers for defining port-device mappings */
#define LP_PARPORT_UNSPEC -4 #define LP_PARPORT_UNSPEC -4
...@@ -145,7 +145,7 @@ struct lp_struct { ...@@ -145,7 +145,7 @@ struct lp_struct {
#endif #endif
wait_queue_head_t waitq; wait_queue_head_t waitq;
unsigned int last_error; unsigned int last_error;
struct semaphore port_mutex; struct mutex port_mutex;
wait_queue_head_t dataq; wait_queue_head_t dataq;
long timeout; long timeout;
unsigned int best_mode; unsigned int best_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment