diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-12 13:44:32 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-12 13:44:32 -0500 |
commit | f392ecfa12de9a2baf72789b00557bac040d6171 (patch) | |
tree | e406fbff12d8b7fa173a23f871d1b3b24473d144 /drivers/serial/serial_core.c | |
parent | 593195f9b2309693f27b402f34573f7920b82c3e (diff) |
[SERIAL] turn serial semaphores into mutexes
Turn several drivers/serial/ semaphores-used-as-mutex into mutexes
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r-- | drivers/serial/serial_core.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 9589509fc5bd..2ca620900bcc 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ | 34 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
@@ -47,7 +48,7 @@ | |||
47 | /* | 48 | /* |
48 | * This is used to lock changes in serial line configuration. | 49 | * This is used to lock changes in serial line configuration. |
49 | */ | 50 | */ |
50 | static DECLARE_MUTEX(port_sem); | 51 | static DEFINE_MUTEX(port_mutex); |
51 | 52 | ||
52 | #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) | 53 | #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) |
53 | 54 | ||
@@ -1472,7 +1473,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1472 | { | 1473 | { |
1473 | struct uart_state *state; | 1474 | struct uart_state *state; |
1474 | 1475 | ||
1475 | down(&port_sem); | 1476 | mutex_lock(&port_mutex); |
1476 | state = drv->state + line; | 1477 | state = drv->state + line; |
1477 | if (down_interruptible(&state->sem)) { | 1478 | if (down_interruptible(&state->sem)) { |
1478 | state = ERR_PTR(-ERESTARTSYS); | 1479 | state = ERR_PTR(-ERESTARTSYS); |
@@ -1509,7 +1510,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1509 | } | 1510 | } |
1510 | 1511 | ||
1511 | out: | 1512 | out: |
1512 | up(&port_sem); | 1513 | mutex_unlock(&port_mutex); |
1513 | return state; | 1514 | return state; |
1514 | } | 1515 | } |
1515 | 1516 | ||
@@ -2219,7 +2220,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2219 | 2220 | ||
2220 | state = drv->state + port->line; | 2221 | state = drv->state + port->line; |
2221 | 2222 | ||
2222 | down(&port_sem); | 2223 | mutex_lock(&port_mutex); |
2223 | if (state->port) { | 2224 | if (state->port) { |
2224 | ret = -EINVAL; | 2225 | ret = -EINVAL; |
2225 | goto out; | 2226 | goto out; |
@@ -2255,7 +2256,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2255 | register_console(port->cons); | 2256 | register_console(port->cons); |
2256 | 2257 | ||
2257 | out: | 2258 | out: |
2258 | up(&port_sem); | 2259 | mutex_unlock(&port_mutex); |
2259 | 2260 | ||
2260 | return ret; | 2261 | return ret; |
2261 | } | 2262 | } |
@@ -2279,7 +2280,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2279 | printk(KERN_ALERT "Removing wrong port: %p != %p\n", | 2280 | printk(KERN_ALERT "Removing wrong port: %p != %p\n", |
2280 | state->port, port); | 2281 | state->port, port); |
2281 | 2282 | ||
2282 | down(&port_sem); | 2283 | mutex_lock(&port_mutex); |
2283 | 2284 | ||
2284 | /* | 2285 | /* |
2285 | * Remove the devices from devfs | 2286 | * Remove the devices from devfs |
@@ -2288,7 +2289,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2288 | 2289 | ||
2289 | uart_unconfigure_port(drv, state); | 2290 | uart_unconfigure_port(drv, state); |
2290 | state->port = NULL; | 2291 | state->port = NULL; |
2291 | up(&port_sem); | 2292 | mutex_unlock(&port_mutex); |
2292 | 2293 | ||
2293 | return 0; | 2294 | return 0; |
2294 | } | 2295 | } |