From nobody Fri Dec 19 07:31:05 2025 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 071FFC5ACB3 for ; Tue, 21 Nov 2023 09:24:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233523AbjKUJYS (ORCPT ); Tue, 21 Nov 2023 04:24:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233700AbjKUJXu (ORCPT ); Tue, 21 Nov 2023 04:23:50 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA031701 for ; Tue, 21 Nov 2023 01:23:30 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1B03C433A9; Tue, 21 Nov 2023 09:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700558609; bh=yT8k5oROMwqMcM21ujTXVO6pmxLHQflyqFgQxsTik/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cz76iEMEWa2wZDM8a7P/JAxgC86aIOrdBrehYNup2d1+hTJGyIr97bk405j66mQNf Lc82FOLTgK3QmTisWpcx/FtuOrg+i38nQWH12pXlEveToSPpAZCc6hg2UZSPe6CeCc K+FRLykFfguYlWGgQ+hphLflfXsuYa1MQkckcOufp8t13ITwe+0ePlCH6fBcOkm5xJ 2ADFc9i2KtcVu2P740mGhe/XGTV6O3IAKVH3LODupbyNsXL835Vbjo1bcUD+eErE4V p8KnOjwTZdcjrZrgbuV7BZvxKs+1czEcHwsvsQMzFtE1KjNhsAwZy8HsejS4TfeX/N 1CXNNHV3YMy3A== 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 14/17] tty: srmcons: use 'count' directly in srmcons_do_write() Date: Tue, 21 Nov 2023 10:22:55 +0100 Message-ID: <20231121092258.9334-15-jirislaby@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231121092258.9334-1-jirislaby@kernel.org> References: <20231121092258.9334-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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) Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: linux-alpha@vger.kernel.org Reviewed-by: Richard Henderson --- 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 b68c5af083cd..8025e2a882ed 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -92,24 +92,24 @@ static int srmcons_do_write(struct tty_port *port, const char *buf, int count) { static char str_cr[1] =3D "\r"; - long c, remaining =3D count; + size_t c; srmcons_result result; int need_cr; =20 - while (remaining > 0) { + while (count > 0) { need_cr =3D 0; /*=20 * Break it up into reasonable size chunks to allow a chance * for input to get in */ - for (c =3D 0; c < min_t(long, 128L, remaining) && !need_cr; c++) + for (c =3D 0; c < min_t(size_t, 128U, count) && !need_cr; c++) if (buf[c] =3D=3D '\n') need_cr =3D 1; =09 while (c > 0) { result.as_long =3D callback_puts(0, buf, c); c -=3D result.bits.c; - remaining -=3D result.bits.c; + count -=3D result.bits.c; buf +=3D result.bits.c; =20 /* --=20 2.42.1