Skip to content

Commit

Permalink
tty: serial: qcom_geni_serial: Use min3 to find minimum of 3 values
Browse files Browse the repository at this point in the history
Use min3 helper to calculate the minimum value of 3 variables.

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Karthikeyan Ramasubramanian authored and Greg Kroah-Hartman committed May 14, 2018
1 parent 6a10635 commit 8e70c47
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/tty/serial/qcom_geni_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport)

avail = (port->tx_fifo_depth - port->tx_wm) * port->tx_bytes_pw;
tail = (xmit->tail + port->xmit_size) & (UART_XMIT_SIZE - 1);
if (chunk > (UART_XMIT_SIZE - tail))
chunk = UART_XMIT_SIZE - tail;
if (chunk > avail)
chunk = avail;

chunk = min3((size_t)chunk, (size_t)(UART_XMIT_SIZE - tail), avail);
if (!chunk)
goto out_write_wakeup;

Expand Down

0 comments on commit 8e70c47

Please sign in to comment.