diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-01 16:53:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 16:47:43 -0400 |
commit | ec79d6056de58511d8e46d9ae59d3878f958dc3e (patch) | |
tree | 8e73cf399c4cb3c31dbf3caced385cfc018a706a /drivers/serial | |
parent | 3f582b8c11014e4ce310d9839fb335164195333f (diff) |
tty: replace BKL with a new tty_lock
As a preparation for replacing the big kernel lock
in the TTY layer, wrap all the callers in new
macros tty_lock, tty_lock_nested and tty_unlock.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/68360serial.c | 4 | ||||
-rw-r--r-- | drivers/serial/crisv10.c | 4 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 768612f8e41e..16f5f2fab032 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c | |||
@@ -1705,7 +1705,7 @@ static void rs_360_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1705 | printk("jiff=%lu...", jiffies); | 1705 | printk("jiff=%lu...", jiffies); |
1706 | #endif | 1706 | #endif |
1707 | 1707 | ||
1708 | lock_kernel(); | 1708 | tty_lock_nested(); /* always held already since we come from ->close */ |
1709 | /* We go through the loop at least once because we can't tell | 1709 | /* We go through the loop at least once because we can't tell |
1710 | * exactly when the last character exits the shifter. There can | 1710 | * exactly when the last character exits the shifter. There can |
1711 | * be at least two characters waiting to be sent after the buffers | 1711 | * be at least two characters waiting to be sent after the buffers |
@@ -1734,7 +1734,7 @@ static void rs_360_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1734 | bdp--; | 1734 | bdp--; |
1735 | } while (bdp->status & BD_SC_READY); | 1735 | } while (bdp->status & BD_SC_READY); |
1736 | current->state = TASK_RUNNING; | 1736 | current->state = TASK_RUNNING; |
1737 | unlock_kernel(); | 1737 | tty_unlock(); |
1738 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT | 1738 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT |
1739 | printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies); | 1739 | printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies); |
1740 | #endif | 1740 | #endif |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 30626440a062..f848e188deae 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -3935,7 +3935,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
3935 | * Check R_DMA_CHx_STATUS bit 0-6=number of available bytes in FIFO | 3935 | * Check R_DMA_CHx_STATUS bit 0-6=number of available bytes in FIFO |
3936 | * R_DMA_CHx_HWSW bit 31-16=nbr of bytes left in DMA buffer (0=64k) | 3936 | * R_DMA_CHx_HWSW bit 31-16=nbr of bytes left in DMA buffer (0=64k) |
3937 | */ | 3937 | */ |
3938 | lock_kernel(); | 3938 | tty_lock_nested(); /* locked already when coming from close */ |
3939 | orig_jiffies = jiffies; | 3939 | orig_jiffies = jiffies; |
3940 | while (info->xmit.head != info->xmit.tail || /* More in send queue */ | 3940 | while (info->xmit.head != info->xmit.tail || /* More in send queue */ |
3941 | (*info->ostatusadr & 0x007f) || /* more in FIFO */ | 3941 | (*info->ostatusadr & 0x007f) || /* more in FIFO */ |
@@ -3952,7 +3952,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
3952 | curr_time_usec - info->last_tx_active_usec; | 3952 | curr_time_usec - info->last_tx_active_usec; |
3953 | } | 3953 | } |
3954 | set_current_state(TASK_RUNNING); | 3954 | set_current_state(TASK_RUNNING); |
3955 | unlock_kernel(); | 3955 | tty_unlock(); |
3956 | } | 3956 | } |
3957 | 3957 | ||
3958 | /* | 3958 | /* |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 3d2acc2265f7..851d7c29132b 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1274,7 +1274,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1274 | struct uart_port *uport; | 1274 | struct uart_port *uport; |
1275 | unsigned long flags; | 1275 | unsigned long flags; |
1276 | 1276 | ||
1277 | BUG_ON(!kernel_locked()); | 1277 | BUG_ON(!tty_locked()); |
1278 | 1278 | ||
1279 | if (!state) | 1279 | if (!state) |
1280 | return; | 1280 | return; |
@@ -1382,7 +1382,7 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1382 | if (port->type == PORT_UNKNOWN || port->fifosize == 0) | 1382 | if (port->type == PORT_UNKNOWN || port->fifosize == 0) |
1383 | return; | 1383 | return; |
1384 | 1384 | ||
1385 | lock_kernel(); | 1385 | tty_lock_nested(); /* already locked when coming from close */ |
1386 | 1386 | ||
1387 | /* | 1387 | /* |
1388 | * Set the check interval to be 1/5 of the estimated time to | 1388 | * Set the check interval to be 1/5 of the estimated time to |
@@ -1429,7 +1429,7 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1429 | break; | 1429 | break; |
1430 | } | 1430 | } |
1431 | set_current_state(TASK_RUNNING); /* might not be needed */ | 1431 | set_current_state(TASK_RUNNING); /* might not be needed */ |
1432 | unlock_kernel(); | 1432 | tty_unlock(); |
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | /* | 1435 | /* |
@@ -1444,7 +1444,7 @@ static void uart_hangup(struct tty_struct *tty) | |||
1444 | struct tty_port *port = &state->port; | 1444 | struct tty_port *port = &state->port; |
1445 | unsigned long flags; | 1445 | unsigned long flags; |
1446 | 1446 | ||
1447 | BUG_ON(!kernel_locked()); | 1447 | BUG_ON(!tty_locked()); |
1448 | pr_debug("uart_hangup(%d)\n", state->uart_port->line); | 1448 | pr_debug("uart_hangup(%d)\n", state->uart_port->line); |
1449 | 1449 | ||
1450 | mutex_lock(&port->mutex); | 1450 | mutex_lock(&port->mutex); |
@@ -1578,7 +1578,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1578 | struct tty_port *port; | 1578 | struct tty_port *port; |
1579 | int retval, line = tty->index; | 1579 | int retval, line = tty->index; |
1580 | 1580 | ||
1581 | BUG_ON(!kernel_locked()); | 1581 | BUG_ON(!tty_locked()); |
1582 | pr_debug("uart_open(%d) called\n", line); | 1582 | pr_debug("uart_open(%d) called\n", line); |
1583 | 1583 | ||
1584 | /* | 1584 | /* |