The port_mutex is actually a semaphore, so easily converted to
a struct mutex.
Signed-off-by: Daniel Walker <dwalker@mvista.com>
---
drivers/char/lp.c | 11 ++++++-----
include/linux/lp.h | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
Index: linux-2.6.23/drivers/char/lp.c
===================================================================
--- linux-2.6.23.orig/drivers/char/lp.c
+++ linux-2.6.23/drivers/char/lp.c
@@ -126,6 +126,7 @@
#include <linux/device.h>
#include <linux/wait.h>
#include <linux/jiffies.h>
+#include <linux/mutex.h>
#include <linux/parport.h>
#undef LP_STATS
@@ -312,7 +313,7 @@ static ssize_t lp_write(struct file * fi
if (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;
if (copy_from_user (kbuf, buf, copy_size)) {
@@ -399,7 +400,7 @@ static ssize_t lp_write(struct file * fi
lp_release_parport (&lp_table[minor]);
}
out_unlock:
- up (&lp_table[minor].port_mutex);
+ mutex_unlock(&lp_table[minor].port_mutex);
return retv;
}
@@ -421,7 +422,7 @@ static ssize_t lp_read(struct file * fil
if (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;
lp_claim_parport_or_block (&lp_table[minor]);
@@ -479,7 +480,7 @@ static ssize_t lp_read(struct file * fil
if (retval > 0 && copy_to_user (buf, kbuf, retval))
retval = -EFAULT;
- up (&lp_table[minor].port_mutex);
+ mutex_unlock(&lp_table[minor].port_mutex);
return retval;
}
@@ -888,7 +889,7 @@ static int __init lp_init (void)
lp_table[i].last_error = 0;
init_waitqueue_head (&lp_table[i].waitq);
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;
}
Index: linux-2.6.23/include/linux/lp.h
===================================================================
--- linux-2.6.23.orig/include/linux/lp.h
+++ linux-2.6.23/include/linux/lp.h
@@ -145,7 +145,7 @@ struct lp_struct {
#endif
wait_queue_head_t waitq;
unsigned int last_error;
- struct semaphore port_mutex;
+ struct mutex port_mutex;
wait_queue_head_t dataq;
long timeout;
unsigned int best_mode;
--
--
| Ondrej Zary | pata_it821x completely broken |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Greg KH | Re: [PATCH 5/7] FUSE: implement ioctl support |
| Andi Kleen | Re: 2.6.27-rc1: critical thermal shutdown on thinkpad x60 |
git: | |
| Jakub Narebski | Re: VCS comparison table |
| Jakub Narebski | Re: git-push through git protocol |
| Michael Smith | Re: [rfc] git submodules howto |
| Olaf Hering | how to find outstanding patches in non-linux-2.6 repositories? |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Richard Stallman | Real men don't attack straw men |
| Stuart Henderson | Re: pfctl |
| Tomas Bodzar | command history in ksh missed when I set $EDITOR |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| Ian Kluft | RESULT: comp.os.linux reorganization, all groups pass (part 3/3) |
| Robert Osterlund | Re: Sharing a swap partition: Linux and Windows? |
| Ian Kluft | 2nd CFV and VOTE ACK: comp.os.linux reorganization |
