From patchwork Tue Sep 6 10:48:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 12967276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C49BDECAAA1 for ; Tue, 6 Sep 2022 10:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=khRVBuZIcids/iLsAHN7yvxgw5rvxt6I29PNJk4G+wo=; b=vjxvPses7tHNMv RMRD/JYWH+yR4fVHMumsb4OkbllAUN2v3rbwWjSsqmZuR5Dhb2uq+c4EP02fpVbaKQOZuv6SG7MJA bK3+Mk8G6OklFqKnG1otdtVj5tLRC5hllL/poTkDiP8qBMa1pQWZBwiGUi8/UU6ON1CtCMG7jAIhf xk4HFYoebcAcm3/aSVIHEPAvGFISc78p0CPqoWTvpJz0tWBPTOthdukqkTtPtkxgxMVtSuv7Vkf6Z 8cK8I405uaTPvhv8Z3FWU4wwpZnmPONM5k39hVajpFyL0CDBEXccGTKG583m4NsSecJZAYQHX8aNg VZV8PtwvyfRion1520wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVW8F-00CaTF-LV; Tue, 06 Sep 2022 10:48:39 +0000 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVW80-00CaH8-CW for linux-arm-kernel@lists.infradead.org; Tue, 06 Sep 2022 10:48:33 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id D8C1333D51; Tue, 6 Sep 2022 10:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662461291; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wXg40FtDTQekKCv07crrElZ3bycY17ctga5/37ZAiuE=; b=zsJoTTROoMn7ToJb08w/FhmULyJS6lXrjQ2hePviemxvzXYrjnhRpd8517I+WWSIXYE85C JXVUMZbKmt0AbgguQ9DkpfqUxAThn2AuR285rz2DJkoxCZCH/BBd98buMOQZxY+uEKoBUF a0c4lvrjPBT5R30q+fwiXLPTdNUMp4A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662461291; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wXg40FtDTQekKCv07crrElZ3bycY17ctga5/37ZAiuE=; b=/oMrtaxMJfXLXWF5nVTzTlHygLO2oVpeeG6F66smS4A1HlLVqKRSHflMVmGKaQ170vMvrZ eC5hXbzNXvcs5qDg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A11862C142; Tue, 6 Sep 2022 10:48:11 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 1/4] tty: serial: move and cleanup vt8500_tx_empty() Date: Tue, 6 Sep 2022 12:48:02 +0200 Message-Id: <20220906104805.23211-2-jslaby@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906104805.23211-1-jslaby@suse.cz> References: <20220906104805.23211-1-jslaby@suse.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220906_034824_693119_38019AF4 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make vt8500_tx_empty() more readable by introducing a new local variable and move the function before handle_tx(). That way we can reuse it in there too. Cc: Signed-off-by: Jiri Slaby --- Notes: [v3] this is new in v3 -- extracted as a separate change from later patches drivers/tty/serial/vt8500_serial.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index 6f08136ce78a..9e2c745b4535 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c @@ -187,6 +187,13 @@ static void handle_rx(struct uart_port *port) tty_flip_buffer_push(tport); } +static unsigned int vt8500_tx_empty(struct uart_port *port) +{ + unsigned int idx = vt8500_read(port, VT8500_URFIDX) & 0x1f; + + return idx < 16 ? TIOCSER_TEMT : 0; +} + static void handle_tx(struct uart_port *port) { struct circ_buf *xmit = &port->state->xmit; @@ -201,7 +208,7 @@ static void handle_tx(struct uart_port *port) return; } - while ((vt8500_read(port, VT8500_URFIDX) & 0x1f) < 16) { + while (vt8500_tx_empty(port)) { if (uart_circ_empty(xmit)) break; @@ -260,12 +267,6 @@ static irqreturn_t vt8500_irq(int irq, void *dev_id) return IRQ_HANDLED; } -static unsigned int vt8500_tx_empty(struct uart_port *port) -{ - return (vt8500_read(port, VT8500_URFIDX) & 0x1f) < 16 ? - TIOCSER_TEMT : 0; -} - static unsigned int vt8500_get_mctrl(struct uart_port *port) { unsigned int usr;