Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp905829pxb; Fri, 22 Apr 2022 13:59:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBrexsBe8on9ts/Vn4GMtxcmUFMEjDXsM+KvrpPnfTEN73JiTG2gOcM2MuWtd87zExB3hz X-Received: by 2002:a05:6402:22c4:b0:41d:78b1:349 with SMTP id dm4-20020a05640222c400b0041d78b10349mr6918340edb.365.1650661187289; Fri, 22 Apr 2022 13:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650661187; cv=none; d=google.com; s=arc-20160816; b=TsxeRLmYlkd8oKY6W62bhdpkvvloHsDDr9mgFY068uWNWL1NQxTrmcTvSAXHLdfjai FiiGHgQ+DRlvFreNYBmmcCIP+w2NM+rOz1/Jo9qmuNlNJI6pPbph7kflgAAj1AKkt4tI TBy9i09+dlKE7yiDCLh+yzjCJIEiYe9iJ+juoZV92DLh6bomYLzkZlel21Z8bqSwnFHF +26bXSTQsHR1og81J72rwgqNhg669uZNlQbxLdI+2dpniNwsRwiCcOceoaPUmkBHyX/S MPZyvcxhX5zZzJlq1qAu84+119M97PqGWT1JH7lV/honpYZ59thKoSNsEEsuKKwRAZjs BQkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ZPmULzmh0/xA3SxYa2A8Wvr5Go8Reyih7fHmmfVIddM=; b=DB5QEAFXfsluKeeHsy/Vp/ttyLHPaNN+XLz6yxCUNTve/JIyi4gwPuIoHPbQWC8AlN Sxb1sA+xy4bcd4Dwp3id55035mWQxo+o+w+YyOgL2Rdq1a4D4HuqvlbQ4wT037HhH1tM Rm2UxrBZzVal6/7yaYAomaAQahoyeuT9JXbKnQLZpOzd4NhbKjA/vOqnFAtW/eDXT4S0 68JDwviOk9vHFkfJFJZGmTPu7bIzEw9BPjAo+0xCKjv9Zp4o5DzjQlI0WZ5zCvWQkkUG NU1OQzVwi1SwSKExLUXZKzpyw+3qhNR8DZwi2FP9g67F73oTtwX1ubuo/1o4v0Qd7ke6 BWdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PpeW2wuu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e18-20020a170906749200b006df76385cbasi7847034ejl.346.2022.04.22.13.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PpeW2wuu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AE1CE335988; Fri, 22 Apr 2022 12:55:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388265AbiDUKUS (ORCPT + 99 others); Thu, 21 Apr 2022 06:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388241AbiDUKUC (ORCPT ); Thu, 21 Apr 2022 06:20:02 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64AD222B0C; Thu, 21 Apr 2022 03:17:11 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BDBFA215FE; Thu, 21 Apr 2022 10:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1650536229; 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=ZPmULzmh0/xA3SxYa2A8Wvr5Go8Reyih7fHmmfVIddM=; b=PpeW2wuuZuaofyJb6mAIjpipTq3x3pQmCGP0oGj9eKi8OqXLBqeTMYEu4rCUbRYKouR2UB 4KJEzhyJokHsmfNUcv7iw+qlUpPCeGXwadm7KQcnFP9l1ykjWl5XR9BrNLSqz4bcy5CzBL TlOpBoZD/GMjf8S4eQylHAqizSNz/AM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1650536229; 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=ZPmULzmh0/xA3SxYa2A8Wvr5Go8Reyih7fHmmfVIddM=; b=VHL8VVSzBsF6qfsey7xd/8/rVRWA5yyEQ5qCAor58h9ClHzA9LmwCdk9wg+4q2xljOe8q8 lPgRV1MaxhY7ZuAQ== 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 948742C142; Thu, 21 Apr 2022 10:17:09 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 2/7] serial: xilinx_uartps: return early in cdns_uart_handle_tx() Date: Thu, 21 Apr 2022 12:17:03 +0200 Message-Id: <20220421101708.5640-3-jslaby@suse.cz> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220421101708.5640-1-jslaby@suse.cz> References: <20220421101708.5640-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return from the true branch of the 'if'. This saves one indentation level and makes the code more readable. The two comments about what obvious code does are removed too. Signed-off-by: Jiri Slaby --- drivers/tty/serial/xilinx_uartps.c | 47 ++++++++++++------------------ 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 250a1d888eeb..b84ae9c07c3b 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -317,37 +317,26 @@ static void cdns_uart_handle_tx(void *dev_id) if (uart_circ_empty(&port->state->xmit)) { writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IDR); - } else { - numbytes = port->fifosize; - while (numbytes && !uart_circ_empty(&port->state->xmit) && - !(readl(port->membase + CDNS_UART_SR) & - CDNS_UART_SR_TXFULL)) { - /* - * Get the data from the UART circular buffer - * and write it to the cdns_uart's TX_FIFO - * register. - */ - writel( - port->state->xmit.buf[port->state->xmit.tail], - port->membase + CDNS_UART_FIFO); - - port->icount.tx++; - - /* - * Adjust the tail of the UART buffer and wrap - * the buffer if it reaches limit. - */ - port->state->xmit.tail = - (port->state->xmit.tail + 1) & - (UART_XMIT_SIZE - 1); - - numbytes--; - } + return; + } - if (uart_circ_chars_pending( - &port->state->xmit) < WAKEUP_CHARS) - uart_write_wakeup(port); + numbytes = port->fifosize; + while (numbytes && !uart_circ_empty(&port->state->xmit) && + !(readl(port->membase + CDNS_UART_SR) & + CDNS_UART_SR_TXFULL)) { + + writel(port->state->xmit.buf[port->state->xmit.tail], + port->membase + CDNS_UART_FIFO); + + port->icount.tx++; + port->state->xmit.tail = (port->state->xmit.tail + 1) & + (UART_XMIT_SIZE - 1); + + numbytes--; } + + if (uart_circ_chars_pending(&port->state->xmit) < WAKEUP_CHARS) + uart_write_wakeup(port); } /** -- 2.36.0