From: Vignesh Raghavendra <vigneshr@ti.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
<linux-serial@vger.kernel.org>, <linux-omap@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 3/6] serial: 8250: 8250_omap: Move locking out from __dma_rx_do_complete()
Date: Thu, 19 Mar 2020 16:33:41 +0530 [thread overview]
Message-ID: <20200319110344.21348-4-vigneshr@ti.com> (raw)
In-Reply-To: <20200319110344.21348-1-vigneshr@ti.com>
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Caller functions of __dma_rx_do_complete() already hold rx_dma_lock.
Therefore move locking out of the function to avoid need to release and
reacquire lock.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
drivers/tty/serial/8250/8250_omap.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index be2b7d374e60..aef0535b62a4 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -736,22 +736,19 @@ static void omap_8250_unthrottle(struct uart_port *port)
#ifdef CONFIG_SERIAL_8250_DMA
static int omap_8250_rx_dma(struct uart_8250_port *p);
+/* Must be called while priv->rx_dma_lock is held */
static void __dma_rx_do_complete(struct uart_8250_port *p)
{
- struct omap8250_priv *priv = p->port.private_data;
struct uart_8250_dma *dma = p->dma;
struct tty_port *tty_port = &p->port.state->port;
struct dma_chan *rxchan = dma->rxchan;
dma_cookie_t cookie;
struct dma_tx_state state;
int count;
- unsigned long flags;
int ret;
- spin_lock_irqsave(&priv->rx_dma_lock, flags);
-
if (!dma->rx_running)
- goto unlock;
+ goto out;
cookie = dma->rx_cookie;
dma->rx_running = 0;
@@ -777,13 +774,12 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)
}
}
if (!count)
- goto unlock;
+ goto out;
ret = tty_insert_flip_string(tty_port, dma->rx_buf, count);
p->port.icount.rx += ret;
p->port.icount.buf_overrun += count - ret;
-unlock:
- spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
+out:
tty_flip_buffer_push(tty_port);
}
@@ -836,9 +832,8 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
if (WARN_ON_ONCE(ret))
priv->rx_dma_broken = true;
}
- spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
-
__dma_rx_do_complete(p);
+ spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
}
static int omap_8250_rx_dma(struct uart_8250_port *p)
--
2.25.2
next prev parent reply other threads:[~2020-03-19 11:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 11:03 [PATCH 0/6] 8250_omap: Add DMA for AM654/J721e type UARTs Vignesh Raghavendra
2020-03-19 11:03 ` [PATCH 1/6] serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout Vignesh Raghavendra
2020-03-19 11:03 ` [PATCH 2/6] serial: 8250: 8250_omap: Account for data in flight during DMA teardown Vignesh Raghavendra
2020-03-19 11:03 ` Vignesh Raghavendra [this message]
2020-03-19 11:03 ` [PATCH 4/6] serial: 8250: 8250_omap: Extend driver data to pass FIFO trigger info Vignesh Raghavendra
2020-03-19 11:03 ` [PATCH 5/6] serial: 8250: 8250_omap: Work around errata causing spurious IRQs with DMA Vignesh Raghavendra
2020-03-19 11:03 ` [PATCH 6/6] serial: 8250: 8250_omap: Add DMA support for UARTs on K3 SoCs Vignesh Raghavendra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319110344.21348-4-vigneshr@ti.com \
--to=vigneshr@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).