All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr
@ 2018-08-27 14:49 jun qian
  2018-08-28  8:36 ` Barry Song
  2018-10-01  8:52 ` Uwe Kleine-König
  0 siblings, 2 replies; 4+ messages in thread
From: jun qian @ 2018-08-27 14:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Barry song, Jiri Slaby, linux-serial, linux-kernel, jun qian

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>
---
 drivers/tty/serial/imx.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 239c0fa2e981..3069ee93583e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -706,27 +706,25 @@ static irqreturn_t imx_uart_rtsint(int irq, void *dev_id)
 {
 	struct imx_port *sport = dev_id;
 	u32 usr1;
-	unsigned long flags;
 
-	spin_lock_irqsave(&sport->port.lock, flags);
+	spin_lock(&sport->port.lock);
 
 	imx_uart_writel(sport, USR1_RTSD, USR1);
 	usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS;
 	uart_handle_cts_change(&sport->port, !!usr1);
 	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;
 }
 
 static irqreturn_t imx_uart_txint(int irq, void *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);
-	spin_unlock_irqrestore(&sport->port.lock, flags);
+	spin_unlock(&sport->port.lock);
 	return IRQ_HANDLED;
 }
 
@@ -735,9 +733,8 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
 	struct imx_port *sport = dev_id;
 	unsigned int rx, flg, ignored = 0;
 	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) {
 		u32 usr2;
@@ -797,7 +794,7 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
 	}
 
 out:
-	spin_unlock_irqrestore(&sport->port.lock, flags);
+	spin_unlock(&sport->port.lock);
 	tty_flip_buffer_push(port);
 	return IRQ_HANDLED;
 }
@@ -903,13 +900,11 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
 	}
 
 	if (usr1 & USR1_DTRD) {
-		unsigned long flags;
-
 		imx_uart_writel(sport, USR1_DTRD, USR1);
 
-		spin_lock_irqsave(&sport->port.lock, flags);
+		spin_lock(&sport->port.lock);
 		imx_uart_mctrl_check(sport);
-		spin_unlock_irqrestore(&sport->port.lock, flags);
+		spin_unlock(&sport->port.lock);
 
 		ret = IRQ_HANDLED;
 	}
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr
  2018-08-27 14:49 [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr jun qian
@ 2018-08-28  8:36 ` Barry Song
  2018-10-01  8:52 ` Uwe Kleine-König
  1 sibling, 0 replies; 4+ messages in thread
From: Barry Song @ 2018-08-28  8:36 UTC (permalink / raw)
  To: hangdianqj; +Cc: Greg Kroah-Hartman, jslaby, linux-serial, LKML

jun qian <hangdianqj@163.com> 于2018年8月27日周一 下午10:49写道:
>
> 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>

many discussions have been done with jun in wechat regarding this patch. and

Reviewed-by: Barry Song <21cnbao@gmail.com>

> ---
>  drivers/tty/serial/imx.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr
  2018-08-27 14:49 [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr jun qian
  2018-08-28  8:36 ` Barry Song
@ 2018-10-01  8:52 ` Uwe Kleine-König
       [not found]   ` <5205c4b4.20a1.166326bb238.Coremail.hangdianqj@163.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2018-10-01  8:52 UTC (permalink / raw)
  To: jun qian
  Cc: Greg Kroah-Hartman, Barry song, Jiri Slaby, linux-serial,
	linux-kernel, kernel

Hello,

On Mon, Aug 27, 2018 at 07:49:04AM -0700, jun qian wrote:
> 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.

"not appropriate" is a bit strong. It's not as optimal as it could be
though, yes.

The change is fine,

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr
       [not found]   ` <5205c4b4.20a1.166326bb238.Coremail.hangdianqj@163.com>
@ 2018-10-02 20:37     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2018-10-02 20:37 UTC (permalink / raw)
  To: 钱君
  Cc: Uwe Kleine-König, Barry song, Jiri Slaby, linux-serial,
	linux-kernel, kernel

On Tue, Oct 02, 2018 at 09:36:50AM +0800, 钱君 wrote:
> 
> 
> I have changed the description content, please refer to the patch file, thanks a lot

I can not apply patches from attachments like this, please resend it
properly and I will be glad to review it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-02 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-27 14:49 [PATCH] tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr jun qian
2018-08-28  8:36 ` Barry Song
2018-10-01  8:52 ` Uwe Kleine-König
     [not found]   ` <5205c4b4.20a1.166326bb238.Coremail.hangdianqj@163.com>
2018-10-02 20:37     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.