aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:14 -0500
commit81861d78c9edf9a9b03a9ba1f5b242d658f16832 (patch)
tree9bd32a48b9869fb809c894e560bb9ee807cf7ad1
parent1e7933defd0fce79b2d8ecdbc7ca37fed0c188ed (diff)
[PATCH] sem2mutex: serial ->port_write_mutex
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/generic_serial.c14
-rw-r--r--drivers/char/ser_a2232.c4
-rw-r--r--drivers/char/sx.c2
-rw-r--r--drivers/char/vme_scc.c2
-rw-r--r--include/linux/generic_serial.h4
5 files changed, 14 insertions, 12 deletions
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index e38a5f0e07bb..5e59c0b42731 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -48,8 +48,8 @@ static int gs_debug;
48#define NEW_WRITE_LOCKING 1 48#define NEW_WRITE_LOCKING 1
49#if NEW_WRITE_LOCKING 49#if NEW_WRITE_LOCKING
50#define DECL /* Nothing */ 50#define DECL /* Nothing */
51#define LOCKIT down (& port->port_write_sem); 51#define LOCKIT mutex_lock(& port->port_write_mutex);
52#define RELEASEIT up (&port->port_write_sem); 52#define RELEASEIT mutex_unlock(&port->port_write_mutex);
53#else 53#else
54#define DECL unsigned long flags; 54#define DECL unsigned long flags;
55#define LOCKIT save_flags (flags);cli () 55#define LOCKIT save_flags (flags);cli ()
@@ -124,14 +124,14 @@ int gs_write(struct tty_struct * tty,
124 /* get exclusive "write" access to this port (problem 3) */ 124 /* get exclusive "write" access to this port (problem 3) */
125 /* This is not a spinlock because we can have a disk access (page 125 /* This is not a spinlock because we can have a disk access (page
126 fault) in copy_from_user */ 126 fault) in copy_from_user */
127 down (& port->port_write_sem); 127 mutex_lock(& port->port_write_mutex);
128 128
129 while (1) { 129 while (1) {
130 130
131 c = count; 131 c = count;
132 132
133 /* This is safe because we "OWN" the "head". Noone else can 133 /* This is safe because we "OWN" the "head". Noone else can
134 change the "head": we own the port_write_sem. */ 134 change the "head": we own the port_write_mutex. */
135 /* Don't overrun the end of the buffer */ 135 /* Don't overrun the end of the buffer */
136 t = SERIAL_XMIT_SIZE - port->xmit_head; 136 t = SERIAL_XMIT_SIZE - port->xmit_head;
137 if (t < c) c = t; 137 if (t < c) c = t;
@@ -153,7 +153,7 @@ int gs_write(struct tty_struct * tty,
153 count -= c; 153 count -= c;
154 total += c; 154 total += c;
155 } 155 }
156 up (& port->port_write_sem); 156 mutex_unlock(& port->port_write_mutex);
157 157
158 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", 158 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
159 (port->flags & GS_TX_INTEN)?"enabled": "disabled"); 159 (port->flags & GS_TX_INTEN)?"enabled": "disabled");
@@ -214,7 +214,7 @@ int gs_write(struct tty_struct * tty,
214 c = count; 214 c = count;
215 215
216 /* This is safe because we "OWN" the "head". Noone else can 216 /* This is safe because we "OWN" the "head". Noone else can
217 change the "head": we own the port_write_sem. */ 217 change the "head": we own the port_write_mutex. */
218 /* Don't overrun the end of the buffer */ 218 /* Don't overrun the end of the buffer */
219 t = SERIAL_XMIT_SIZE - port->xmit_head; 219 t = SERIAL_XMIT_SIZE - port->xmit_head;
220 if (t < c) c = t; 220 if (t < c) c = t;
@@ -888,7 +888,7 @@ int gs_init_port(struct gs_port *port)
888 spin_lock_irqsave (&port->driver_lock, flags); 888 spin_lock_irqsave (&port->driver_lock, flags);
889 if (port->tty) 889 if (port->tty)
890 clear_bit(TTY_IO_ERROR, &port->tty->flags); 890 clear_bit(TTY_IO_ERROR, &port->tty->flags);
891 init_MUTEX(&port->port_write_sem); 891 mutex_init(&port->port_write_mutex);
892 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 892 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
893 spin_unlock_irqrestore(&port->driver_lock, flags); 893 spin_unlock_irqrestore(&port->driver_lock, flags);
894 gs_set_termios(port->tty, NULL); 894 gs_set_termios(port->tty, NULL);
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c
index fee68cc895f8..510bd3e0e88b 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/char/ser_a2232.c
@@ -97,7 +97,7 @@
97#include <asm/amigahw.h> 97#include <asm/amigahw.h>
98#include <linux/zorro.h> 98#include <linux/zorro.h>
99#include <asm/irq.h> 99#include <asm/irq.h>
100#include <asm/semaphore.h> 100#include <linux/mutex.h>
101 101
102#include <linux/delay.h> 102#include <linux/delay.h>
103 103
@@ -654,7 +654,7 @@ static void a2232_init_portstructs(void)
654 port->gs.closing_wait = 30 * HZ; 654 port->gs.closing_wait = 30 * HZ;
655 port->gs.rd = &a2232_real_driver; 655 port->gs.rd = &a2232_real_driver;
656#ifdef NEW_WRITE_LOCKING 656#ifdef NEW_WRITE_LOCKING
657 init_MUTEX(&(port->gs.port_write_sem)); 657 init_MUTEX(&(port->gs.port_write_mutex));
658#endif 658#endif
659 init_waitqueue_head(&port->gs.open_wait); 659 init_waitqueue_head(&port->gs.open_wait);
660 init_waitqueue_head(&port->gs.close_wait); 660 init_waitqueue_head(&port->gs.close_wait);
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index a6b4f02bdceb..3b4747230270 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -2318,7 +2318,7 @@ static int sx_init_portstructs (int nboards, int nports)
2318 port->board = board; 2318 port->board = board;
2319 port->gs.rd = &sx_real_driver; 2319 port->gs.rd = &sx_real_driver;
2320#ifdef NEW_WRITE_LOCKING 2320#ifdef NEW_WRITE_LOCKING
2321 port->gs.port_write_sem = MUTEX; 2321 port->gs.port_write_mutex = MUTEX;
2322#endif 2322#endif
2323 port->gs.driver_lock = SPIN_LOCK_UNLOCKED; 2323 port->gs.driver_lock = SPIN_LOCK_UNLOCKED;
2324 /* 2324 /*
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index d9325281e482..fd00822ac145 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -184,7 +184,7 @@ static void scc_init_portstructs(void)
184 port->gs.closing_wait = 30 * HZ; 184 port->gs.closing_wait = 30 * HZ;
185 port->gs.rd = &scc_real_driver; 185 port->gs.rd = &scc_real_driver;
186#ifdef NEW_WRITE_LOCKING 186#ifdef NEW_WRITE_LOCKING
187 port->gs.port_write_sem = MUTEX; 187 port->gs.port_write_mutex = MUTEX;
188#endif 188#endif
189 init_waitqueue_head(&port->gs.open_wait); 189 init_waitqueue_head(&port->gs.open_wait);
190 init_waitqueue_head(&port->gs.close_wait); 190 init_waitqueue_head(&port->gs.close_wait);
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 0abe9d9a0069..652611a4bdcd 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -12,6 +12,8 @@
12#ifndef GENERIC_SERIAL_H 12#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 13#define GENERIC_SERIAL_H
14 14
15#include <linux/mutex.h>
16
15struct real_driver { 17struct real_driver {
16 void (*disable_tx_interrupts) (void *); 18 void (*disable_tx_interrupts) (void *);
17 void (*enable_tx_interrupts) (void *); 19 void (*enable_tx_interrupts) (void *);
@@ -34,7 +36,7 @@ struct gs_port {
34 int xmit_head; 36 int xmit_head;
35 int xmit_tail; 37 int xmit_tail;
36 int xmit_cnt; 38 int xmit_cnt;
37 struct semaphore port_write_sem; 39 struct mutex port_write_mutex;
38 int flags; 40 int flags;
39 wait_queue_head_t open_wait; 41 wait_queue_head_t open_wait;
40 wait_queue_head_t close_wait; 42 wait_queue_head_t close_wait;