Skip to content

Commit c974991

Browse files
hangdianmarkgregkh
authored andcommitted
tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr
Before the program enters the uart ISR, the local interrupt has been disabled by the system, so it's not appropriate to use spin_lock_irqsave interface in the ISR. Signed-off-by: jun qian <[email protected]> Reviewed-by: Barry Song <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent deeb33e commit c974991

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

drivers/tty/serial/imx.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -706,27 +706,25 @@ static irqreturn_t imx_uart_rtsint(int irq, void *dev_id)
706706
{
707707
struct imx_port *sport = dev_id;
708708
u32 usr1;
709-
unsigned long flags;
710709

711-
spin_lock_irqsave(&sport->port.lock, flags);
710+
spin_lock(&sport->port.lock);
712711

713712
imx_uart_writel(sport, USR1_RTSD, USR1);
714713
usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS;
715714
uart_handle_cts_change(&sport->port, !!usr1);
716715
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
717716

718-
spin_unlock_irqrestore(&sport->port.lock, flags);
717+
spin_unlock(&sport->port.lock);
719718
return IRQ_HANDLED;
720719
}
721720

722721
static irqreturn_t imx_uart_txint(int irq, void *dev_id)
723722
{
724723
struct imx_port *sport = dev_id;
725-
unsigned long flags;
726724

727-
spin_lock_irqsave(&sport->port.lock, flags);
725+
spin_lock(&sport->port.lock);
728726
imx_uart_transmit_buffer(sport);
729-
spin_unlock_irqrestore(&sport->port.lock, flags);
727+
spin_unlock(&sport->port.lock);
730728
return IRQ_HANDLED;
731729
}
732730

@@ -735,9 +733,8 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
735733
struct imx_port *sport = dev_id;
736734
unsigned int rx, flg, ignored = 0;
737735
struct tty_port *port = &sport->port.state->port;
738-
unsigned long flags;
739736

740-
spin_lock_irqsave(&sport->port.lock, flags);
737+
spin_lock(&sport->port.lock);
741738

742739
while (imx_uart_readl(sport, USR2) & USR2_RDR) {
743740
u32 usr2;
@@ -797,7 +794,7 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
797794
}
798795

799796
out:
800-
spin_unlock_irqrestore(&sport->port.lock, flags);
797+
spin_unlock(&sport->port.lock);
801798
tty_flip_buffer_push(port);
802799
return IRQ_HANDLED;
803800
}
@@ -903,13 +900,11 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
903900
}
904901

905902
if (usr1 & USR1_DTRD) {
906-
unsigned long flags;
907-
908903
imx_uart_writel(sport, USR1_DTRD, USR1);
909904

910-
spin_lock_irqsave(&sport->port.lock, flags);
905+
spin_lock(&sport->port.lock);
911906
imx_uart_mctrl_check(sport);
912-
spin_unlock_irqrestore(&sport->port.lock, flags);
907+
spin_unlock(&sport->port.lock);
913908

914909
ret = IRQ_HANDLED;
915910
}

0 commit comments

Comments
 (0)