From patchwork Thu May 3 20:14:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Ramasubramanian X-Patchwork-Id: 10379147 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C082760327 for ; Thu, 3 May 2018 20:15:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADF0629273 for ; Thu, 3 May 2018 20:15:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A27DE29277; Thu, 3 May 2018 20:15:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F46429273 for ; Thu, 3 May 2018 20:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751382AbeECUPI (ORCPT ); Thu, 3 May 2018 16:15:08 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60236 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbeECUPF (ORCPT ); Thu, 3 May 2018 16:15:05 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0130A607CF; Thu, 3 May 2018 20:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525378505; bh=L68NnFPCu1wsAuKcDzo4bFjp5tvwDJKRQyebnaOQ8bM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/EB+aFtAGx2+SSjNmsYAclKO+ugYx5jaz79DnglkNfoMl9Ycj0/LemIWu3hyKdl/ FX65joaqhLdsLJkN3/hiw7Iuu/3umjpsYClspPgwfeNxy+eubMpGOzW91GGjcc/xyM ZOCBMQmsNNrlFZGUM3/rf619guBOTZF3W6e9V5sY= Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kramasub@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 68BA7607CF; Thu, 3 May 2018 20:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525378504; bh=L68NnFPCu1wsAuKcDzo4bFjp5tvwDJKRQyebnaOQ8bM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TzqOPpZLjWA6peLJO5O8FWQ8Xvaldmca1h2VnYq1nVWqdBmNj6VZOeuhoncXshb31 Ej4gFQ/GLudyol/2590cbuXUYLTjpnFG74/Qlaq2ov0G2HAeyyXm+2X0PNLj9JLk2Q U5pBbEx1RSVOFfIj+u2WYahGKzeq2qC/vYdePC9A= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 68BA7607CF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kramasub@codeaurora.org From: Karthikeyan Ramasubramanian To: gregkh@linuxfoundation.org, jslaby@suse.com Cc: Karthikeyan Ramasubramanian , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, evgreen@chromium.org, acourbot@chromium.org, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, bjorn.andersson@linaro.org Subject: [PATCH v3 3/8] tty: serial: qcom_geni_serial: Use min3 to find minimum of 3 values Date: Thu, 3 May 2018 14:14:35 -0600 Message-Id: <1525378480-10296-4-git-send-email-kramasub@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525378480-10296-1-git-send-email-kramasub@codeaurora.org> References: <1525378480-10296-1-git-send-email-kramasub@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use min3 helper to calculate the minimum value of 3 variables. Signed-off-by: Karthikeyan Ramasubramanian Reviewed-by: Matthias Kaehlcke Reviewed-by: Stephen Boyd --- drivers/tty/serial/qcom_geni_serial.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 2d66b30b..3767d5d 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -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;