Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp252348rdf; Tue, 21 Nov 2023 01:24:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/iznkSfq08bj59HrzRyAmW+/Yb7tH+CFBOXv0m9wYZ8ydVEH4gdPcABOE4c74bE1kpfbk X-Received: by 2002:a05:6a00:3394:b0:6cb:634a:c83a with SMTP id cm20-20020a056a00339400b006cb634ac83amr10991396pfb.33.1700558676081; Tue, 21 Nov 2023 01:24:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700558676; cv=none; d=google.com; s=arc-20160816; b=syAPtE4XyBFXzIPt6hBezqGOCfpNcKV631HVdVosYlH97CyI9xvMVzbR0VUS+fTWRB 2Fj7PzpH0rwY4FmZxxofxClRp+915kOQwwkq16SbOmbGrOqe6gmSosaSuT8ycOQ4P0sc Q71q7Me+812Q2MXZqmK+2zCnx+XYq+cWo528Vav1MRuY9QnubrRMZnDz00xJsF7EmmHh Q/eBCqw38ZUdFFzGwmEYV7YB1Ee6U7p8REyl/nGoig+j2EdjCa36Bbq/m0WeATQDs0I2 MGvRvG2my043nNgWeClyr4rqhPnsamw4HOj5Kd75nDT9JWe8mGdBZacaRqEpxz7MXOeo V/eA== 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; bh=CJp9msGw/g6S/151SlJZ+hNvnN0bsoQDtKqtUlFXOl0=; fh=Omeij3RQJitYcv5r7VTxN+idsQHibM7jPsz6z3jqTjA=; b=weppKYlQrunXGrQdNAXLRkXBslu0HpFuyiXWT/7sKKK3FI6Z9elR8hqpAKUjL+9Nmg fMoOunpMjnWQVvhOuQ2+4madVhH2MckgIEp0kkDZGG4GrH2H0ORY8o8ZP7eV5FThLVFo Ux1VAnqJG/dCUeK76jhda1wLe9UMzfzrV4QwOEh45k446xiJOPRsImnsBpijA/B7P2ZZ BnpsiBntIhK3k45x01kdiusXucfaJyRBlO/sSWMqbOsdq9mrAHXt9ZlEHEgpwiU6TONF u+Iq2H2B4HxkICxiANnGKgaFEYd1Ry1IIkyeC7fMLPwLuOTWUF5O2ohIQNUuQ/rvfIFm tWSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cz76iEME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s18-20020a632c12000000b00578c64433c9si9777619pgs.894.2023.11.21.01.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 01:24:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cz76iEME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 489F580ECF16; Tue, 21 Nov 2023 01:24:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233692AbjKUJYR (ORCPT + 99 others); Tue, 21 Nov 2023 04:24:17 -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: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 01:24:27 -0800 (PST) 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 --- 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] = "\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