提交 2aa9c5db 编写于 作者: D Daniel Walker 提交者: Linus Torvalds

uml: port mutex conversion

The port_sem is already used as a mutex since it's using DECLARE_MUTEX(), but
the underlying construct is still a semaphore ..  This patch switches it over
to a struct mutex.
Signed-off-by: NDaniel Walker <dwalker@mvista.com>
Signed-off-by: NJeff Dike <jdike@linux.intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e98fa281
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "linux/completion.h" #include "linux/completion.h"
#include "linux/interrupt.h" #include "linux/interrupt.h"
#include "linux/list.h" #include "linux/list.h"
#include "linux/mutex.h"
#include "asm/atomic.h" #include "asm/atomic.h"
#include "init.h" #include "init.h"
#include "irq_kern.h" #include "irq_kern.h"
...@@ -120,7 +121,7 @@ static int port_accept(struct port_list *port) ...@@ -120,7 +121,7 @@ static int port_accept(struct port_list *port)
return 0; return 0;
} }
static DECLARE_MUTEX(ports_sem); static DEFINE_MUTEX(ports_mutex);
static LIST_HEAD(ports); static LIST_HEAD(ports);
static void port_work_proc(struct work_struct *unused) static void port_work_proc(struct work_struct *unused)
...@@ -161,7 +162,7 @@ void *port_data(int port_num) ...@@ -161,7 +162,7 @@ void *port_data(int port_num)
struct port_dev *dev = NULL; struct port_dev *dev = NULL;
int fd; int fd;
down(&ports_sem); mutex_lock(&ports_mutex);
list_for_each(ele, &ports) { list_for_each(ele, &ports) {
port = list_entry(ele, struct port_list, list); port = list_entry(ele, struct port_list, list);
if (port->port == port_num) if (port->port == port_num)
...@@ -216,7 +217,7 @@ void *port_data(int port_num) ...@@ -216,7 +217,7 @@ void *port_data(int port_num)
out_free: out_free:
kfree(port); kfree(port);
out: out:
up(&ports_sem); mutex_unlock(&ports_mutex);
return dev; return dev;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册