aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunzilog.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/sunzilog.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/sunzilog.c')
-rw-r--r--drivers/serial/sunzilog.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 8e65206d3d76..bff42a7b89d0 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -610,27 +610,28 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id, struct pt_regs *reg
610static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port) 610static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port)
611{ 611{
612 struct zilog_channel __iomem *channel; 612 struct zilog_channel __iomem *channel;
613 unsigned long flags;
614 unsigned char status; 613 unsigned char status;
615 614
616 spin_lock_irqsave(&port->lock, flags);
617
618 channel = ZILOG_CHANNEL_FROM_PORT(port); 615 channel = ZILOG_CHANNEL_FROM_PORT(port);
619 status = sbus_readb(&channel->control); 616 status = sbus_readb(&channel->control);
620 ZSDELAY(); 617 ZSDELAY();
621 618
622 spin_unlock_irqrestore(&port->lock, flags);
623
624 return status; 619 return status;
625} 620}
626 621
627/* The port lock is not held. */ 622/* The port lock is not held. */
628static unsigned int sunzilog_tx_empty(struct uart_port *port) 623static unsigned int sunzilog_tx_empty(struct uart_port *port)
629{ 624{
625 unsigned long flags;
630 unsigned char status; 626 unsigned char status;
631 unsigned int ret; 627 unsigned int ret;
632 628
629 spin_lock_irqsave(&port->lock, flags);
630
633 status = sunzilog_read_channel_status(port); 631 status = sunzilog_read_channel_status(port);
632
633 spin_unlock_irqrestore(&port->lock, flags);
634
634 if (status & Tx_BUF_EMP) 635 if (status & Tx_BUF_EMP)
635 ret = TIOCSER_TEMT; 636 ret = TIOCSER_TEMT;
636 else 637 else
@@ -639,7 +640,7 @@ static unsigned int sunzilog_tx_empty(struct uart_port *port)
639 return ret; 640 return ret;
640} 641}
641 642
642/* The port lock is not held. */ 643/* The port lock is held and interrupts are disabled. */
643static unsigned int sunzilog_get_mctrl(struct uart_port *port) 644static unsigned int sunzilog_get_mctrl(struct uart_port *port)
644{ 645{
645 unsigned char status; 646 unsigned char status;