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 <hangdianqj@163.com>
Reviewed-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
jun qian 2018-08-27 07:49:04 -07:00 committed by Greg Kroah-Hartman
parent deeb33e8fd
commit c974991d26

View File

@ -706,27 +706,25 @@ static irqreturn_t imx_uart_rtsint(int irq, void *dev_id)
{ {
struct imx_port *sport = dev_id; struct imx_port *sport = dev_id;
u32 usr1; u32 usr1;
unsigned long flags;
spin_lock_irqsave(&sport->port.lock, flags); spin_lock(&sport->port.lock);
imx_uart_writel(sport, USR1_RTSD, USR1); imx_uart_writel(sport, USR1_RTSD, USR1);
usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS; usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS;
uart_handle_cts_change(&sport->port, !!usr1); uart_handle_cts_change(&sport->port, !!usr1);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait); wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
spin_unlock_irqrestore(&sport->port.lock, flags); spin_unlock(&sport->port.lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t imx_uart_txint(int irq, void *dev_id) static irqreturn_t imx_uart_txint(int irq, void *dev_id)
{ {
struct imx_port *sport = dev_id; struct imx_port *sport = dev_id;
unsigned long flags;
spin_lock_irqsave(&sport->port.lock, flags); spin_lock(&sport->port.lock);
imx_uart_transmit_buffer(sport); imx_uart_transmit_buffer(sport);
spin_unlock_irqrestore(&sport->port.lock, flags); spin_unlock(&sport->port.lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -735,9 +733,8 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
struct imx_port *sport = dev_id; struct imx_port *sport = dev_id;
unsigned int rx, flg, ignored = 0; unsigned int rx, flg, ignored = 0;
struct tty_port *port = &sport->port.state->port; struct tty_port *port = &sport->port.state->port;
unsigned long flags;
spin_lock_irqsave(&sport->port.lock, flags); spin_lock(&sport->port.lock);
while (imx_uart_readl(sport, USR2) & USR2_RDR) { while (imx_uart_readl(sport, USR2) & USR2_RDR) {
u32 usr2; u32 usr2;
@ -797,7 +794,7 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
} }
out: out:
spin_unlock_irqrestore(&sport->port.lock, flags); spin_unlock(&sport->port.lock);
tty_flip_buffer_push(port); tty_flip_buffer_push(port);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -903,13 +900,11 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
} }
if (usr1 & USR1_DTRD) { if (usr1 & USR1_DTRD) {
unsigned long flags;
imx_uart_writel(sport, USR1_DTRD, USR1); imx_uart_writel(sport, USR1_DTRD, USR1);
spin_lock_irqsave(&sport->port.lock, flags); spin_lock(&sport->port.lock);
imx_uart_mctrl_check(sport); imx_uart_mctrl_check(sport);
spin_unlock_irqrestore(&sport->port.lock, flags); spin_unlock(&sport->port.lock);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }