Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp252498rdf; Tue, 21 Nov 2023 01:25:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMQNIGc68ie4sLP6MmI5+CQ/flHVSCNOW6qWCJ4CR/Sa/rwJ8HfU4gIetJ+ewLxDJ9g/vz X-Received: by 2002:a17:903:32cb:b0:1cf:56b2:3604 with SMTP id i11-20020a17090332cb00b001cf56b23604mr8121028plr.52.1700558699743; Tue, 21 Nov 2023 01:24:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700558699; cv=none; d=google.com; s=arc-20160816; b=fx4hRAcs63gdpyxfFKAZ1g3X4hOr7iCRY/osiJvu0uXUL+aj6S13v/KLETszYq0SHi Xuwnu/44HKdJOdWR3a8Eys3bF+pRb4AEqUGUpaHchVROHOnc1VoZ4KH/SWX3LBbQ9qmE yzlw6mRn1EMnAZiGx+w5UX0daKVDHN6zBikTbbLk9l0AYe1Y5Dh9g/CNTDN7gfn+Yn9y YuuorwBm3oHBP6oODWpr/gc8hRjW97vNI/g3ADn6/uiUXXCLNJItYfrkpYlmvhWd4gKZ slis0WOV0aKAXl6qSj7Xjtzv9IWROJrRXJkmA5n3h5hkAOeZ/UE0aiRpvzznPDClGpA5 et6g== 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=ZSbkIfa5MqrTvTTx5Krfx9KhAfB/1/pFyHzOwfSKcmY=; fh=Omeij3RQJitYcv5r7VTxN+idsQHibM7jPsz6z3jqTjA=; b=v2Ureo92j4yexm4AUstRmsNlcg+6S4SpxUpxwBn3tkZxAQGg+S5kc4LzxVRh1FboYY bixKKQxeInzuCKACl+gMtBYvvjm2HBbRyckIeqwyPUYoJlYTQXY5Jz4rSMOM5ULA2T+8 3FJuCpR8gNDwQ5Ayp1kX0FH1LhHSGZSN9WC6xf456a7ZTt8seneS0wzNqXXGU0qfns+2 Qq++w1da/bOhCi+exhXQPhGUm1HwouRZm8biSInaEVtpWjlOP6d2JTnKErkj47a5hEHf EmvFYlNSlDPVmL/wC4DPYgg2vYSMr7Vu+1LEuKqStbtGMG+Pje4pKTKFiPbPZvsmmE6r xCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PCcVQCue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k10-20020a170902ce0a00b001b222cd9826si10687284plg.349.2023.11.21.01.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 01:24:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PCcVQCue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 4461A80CD72C; Tue, 21 Nov 2023 01:24:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233639AbjKUJYJ (ORCPT + 99 others); Tue, 21 Nov 2023 04:24:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233655AbjKUJXs (ORCPT ); Tue, 21 Nov 2023 04:23:48 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A96FB10E7 for ; Tue, 21 Nov 2023 01:23:27 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 841C4C433AB; Tue, 21 Nov 2023 09:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700558607; bh=A+gwjfR1YZFEn//O7QquhnOOdPgWP51q1cNT1xEbGz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PCcVQCueYuWyDY4P/DEB7ksJqQttXRDIPuOZ7d1S9t+TY1NrMTLU+chfM1S6vlv+p WBd57pcx7EOKaym2OQcNLU7UHsd+qb/aAAsDtIkFG6hIChg838AvK6hstPgL1gFiLN FiXQmY6zoCqEKQPuyPESrYNhXJ6NsQb1ojKzz50bJUjUKJxAXZW0fYqvLaFHkEjCBp LSTeR5/RUtifDRKwQmwM+896CIvlaUn8mg8TS0FPcDdLxOxd+K9Lo7jqqeytBxSkHY qaJn/aoW6NRZPIMKquDInl67DpFnQFfRKdSx15MeAGPSiwYZxY8lvB2AnsUOJ8XAyb +0Nmw/Pstmt6Q== 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 13/17] tty: srmcons: use 'buf' directly in srmcons_do_write() Date: Tue, 21 Nov 2023 10:22:54 +0100 Message-ID: <20231121092258.9334-14-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=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 01:24:54 -0800 (PST) There is no need to have a separate iterator ('cur') through 'buf' in srmcons_do_write(). 'buf' can be used directly which simplifies the code a bit. 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index d6139dbae4ac..b68c5af083cd 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -94,24 +94,23 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count) static char str_cr[1] = "\r"; long c, remaining = count; srmcons_result result; - char *cur; int need_cr; - for (cur = (char *)buf; remaining > 0; ) { + while (remaining > 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++) - if (cur[c] == '\n') + if (buf[c] == '\n') need_cr = 1; while (c > 0) { - result.as_long = callback_puts(0, cur, c); + result.as_long = callback_puts(0, buf, c); c -= result.bits.c; remaining -= result.bits.c; - cur += result.bits.c; + buf += result.bits.c; /* * Check for pending input iff a tty port was provided -- 2.42.1