aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsab.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-29 04:42:38 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-06-29 04:42:38 -0400
commitc5f4644e6c8ba21666128603e4e92544d3cd740d (patch)
tree1a8b4c730ca575d4b1118af174b070764803fb2c /drivers/serial/sunsab.c
parenta839688362e32f01608838516036697e30618b39 (diff)
[PATCH] Serial: Adjust serial locking
This patch changes the way serial ports are locked when getting modem status. This change is necessary because we will need to atomically read the modem status and take action depending on the CTS status. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/sunsab.c')
-rw-r--r--drivers/serial/sunsab.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 10e2990a40d4..8d198880756a 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -426,18 +426,15 @@ static void sunsab_set_mctrl(struct uart_port *port, unsigned int mctrl)
426 sunsab_tx_idle(up); 426 sunsab_tx_idle(up);
427} 427}
428 428
429/* port->lock is not held. */ 429/* port->lock is held by caller and interrupts are disabled. */
430static unsigned int sunsab_get_mctrl(struct uart_port *port) 430static unsigned int sunsab_get_mctrl(struct uart_port *port)
431{ 431{
432 struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; 432 struct uart_sunsab_port *up = (struct uart_sunsab_port *) port;
433 unsigned long flags;
434 unsigned char val; 433 unsigned char val;
435 unsigned int result; 434 unsigned int result;
436 435
437 result = 0; 436 result = 0;
438 437
439 spin_lock_irqsave(&up->port.lock, flags);
440
441 val = readb(&up->regs->r.pvr); 438 val = readb(&up->regs->r.pvr);
442 result |= (val & up->pvr_dsr_bit) ? 0 : TIOCM_DSR; 439 result |= (val & up->pvr_dsr_bit) ? 0 : TIOCM_DSR;
443 440
@@ -447,8 +444,6 @@ static unsigned int sunsab_get_mctrl(struct uart_port *port)
447 val = readb(&up->regs->r.star); 444 val = readb(&up->regs->r.star);
448 result |= (val & SAB82532_STAR_CTS) ? TIOCM_CTS : 0; 445 result |= (val & SAB82532_STAR_CTS) ? TIOCM_CTS : 0;
449 446
450 spin_unlock_irqrestore(&up->port.lock, flags);
451
452 return result; 447 return result;
453} 448}
454 449