summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorJiri Slaby (SUSE) <jirislaby@kernel.org>2023-04-20 11:35:14 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 13:32:51 +0200
commit5c7e105cd156fc9adf5294a83623d7a40c15f9b9 (patch)
tree92932c0be88a8b509e802024dc7f1a5f12f9710d /drivers/tty
parent254d5a59464eea1324353d84c0f614c413e8e54f (diff)
downloadlinux-5c7e105cd156fc9adf5294a83623d7a40c15f9b9.tar.gz
tty: serial: simplify qcom_geni_serial_send_chunk_fifo()
* use memcpy() instead of the loop (removes c variable) * use remaining parameter directly (removes chunk variable) The code is simpler and easier to follow. Cc: Andy Gross <agross@kernel.org> Cc: Bjorn Andersson <andersson@kernel.org> Cc: Konrad Dybcio <konrad.dybcio@linaro.org> Cc: linux-arm-msm@vger.kernel.org Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230420093514.13055-1-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/qcom_geni_serial.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 1881dd5b3c4d..08dc3e2a729c 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -854,21 +854,19 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport)
}
static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport,
- unsigned int chunk)
+ unsigned int remaining)
{
struct qcom_geni_serial_port *port = to_dev_port(uport);
struct circ_buf *xmit = &uport->state->xmit;
- unsigned int tx_bytes, c, remaining = chunk;
+ unsigned int tx_bytes;
u8 buf[BYTES_PER_FIFO_WORD];
while (remaining) {
memset(buf, 0, sizeof(buf));
tx_bytes = min(remaining, BYTES_PER_FIFO_WORD);
- for (c = 0; c < tx_bytes ; c++) {
- buf[c] = xmit->buf[xmit->tail];
- uart_xmit_advance(uport, 1);
- }
+ memcpy(buf, &xmit->buf[xmit->tail], tx_bytes);
+ uart_xmit_advance(uport, tx_bytes);
iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1);