From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 431FEC4167B for ; Mon, 27 Nov 2023 12:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233344AbjK0MhR (ORCPT ); Mon, 27 Nov 2023 07:37:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233192AbjK0MhO (ORCPT ); Mon, 27 Nov 2023 07:37:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19F33135 for ; Mon, 27 Nov 2023 04:37:21 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F097FC433C7; Mon, 27 Nov 2023 12:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701088640; bh=Os/aL6pwYCaykDQuL9blVdurCOtOksBV5A81B3Uv14U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WmPBIhDNqfe952AulwvGdFAO4H/dT83Ku1Mmt1cdCOYV45wnHaGDc+d3pBhUq8pUO e+18m5V/HtE8EeOmpk5o4wYYdarBexzxBZ4Bs90RKobiw6pQyKnZ58MwA5lsa8LHDj ueglzzLkrDb8FRQ/HWjrG5/K3pegBNHg3sSsD8WyKX/I58k/EIjxhlHJf0mb2tYysl uGDIBDu1HdAhOHxfTr0A7cbfah114t01pzD+9FVpBawlAJQtStpqw9WSNyY4cIe1Zh ZviGo/eYCOXPZjQtx816LO5B+Zp74bf5mYlB487BUSNDqyepwS3lxSHNFxol1Guoaj VFYS+EpXbI6kQ== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Richard Henderson , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org Subject: [PATCH 3/5] tty: srmcons: use 'count' directly in srmcons_do_write() Date: Mon, 27 Nov 2023 13:37:11 +0100 Message-ID: <20231127123713.14504-3-jirislaby@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231127123713.14504-1-jirislaby@kernel.org> References: <20231127123713.14504-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similarly to 'buf' in the previous patch, there is no need to have a separate counter ('remaining') in srmcons_do_write(). 'count' can be used directly which simplifies the code a bit. Note that the type of the current count ('c') is changed from 'long' to 'size_t' so that: 1) it is prepared for the upcoming change of 'count's type, and 2) is unsigned. Signed-off-by: Jiri Slaby (SUSE) Reviewed-by: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: linux-alpha@vger.kernel.org --- Notes: [v2] reordered so that it makes sense arch/alpha/kernel/srmcons.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index de896fa9829e..32bc098de7da 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -92,24 +92,24 @@ static void srmcons_do_write(struct tty_port *port, const char *buf, int count) { static char str_cr[1] = "\r"; - long c, remaining = count; + size_t c; srmcons_result result; int need_cr; - while (remaining > 0) { + while (count > 0) { need_cr = 0; /* * Break it up into reasonable size chunks to allow a chance * for input to get in */ - for (c = 0; c < min_t(long, 128L, remaining) && !need_cr; c++) + for (c = 0; c < min_t(size_t, 128U, count) && !need_cr; c++) if (buf[c] == '\n') need_cr = 1; while (c > 0) { result.as_long = callback_puts(0, buf, c); c -= result.bits.c; - remaining -= result.bits.c; + count -= result.bits.c; buf += result.bits.c; /* -- 2.42.1