Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp564673rdf; Tue, 21 Nov 2023 09:49:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzoVH99e7f2XiEEYgyuTFqqxFjcBAKs24u4BI0pkn+0FyKmdS2DSZOMxx/ZgwCKlg3vfSl X-Received: by 2002:a05:6808:1410:b0:3b5:655b:2f6e with SMTP id w16-20020a056808141000b003b5655b2f6emr12537173oiv.15.1700588960087; Tue, 21 Nov 2023 09:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588960; cv=none; d=google.com; s=arc-20160816; b=Ij1yKSbxuZi+FFxyFFgF50aSqQC8wF7be2+VenUAoJcK3eIP7XDJd/BOL3CdPFeeiR G/chTHt3ytCiLU4C0iRhTwMzm+kkDqqjLngSZf/4Dh0I8CAIFKVaPZO5VWw4W5jj7jtM Rx1+aLI28feMAIua9JInmJ2sZTA/dRRjlZ+x0B2t/vrSj8BoyNz892ZVduEbt57WOlYF 0IBiz3HyCefVQMgKS1cl+psZ+6KJZuEPLXGEEgF62NqUIdX6AVbN2b3hBE16l977//OQ sD8SqvGdSmrleu8H11zDk79NDXuIvheCEAaPXsh/e7+l1ws4eTDz+0EN6uGPs5JF+dhR lhmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=U7Rbioe+AA0m1Xzil+Qj4X93APjsim1oxKrG1rmg9wU=; fh=gjpP82ZlXtCfvX6ifD/7d0Ld41SDOkTelr02lJ9lOkw=; b=yGe6UAMEyLd7OWMqY5uucNzITC0DSu91E5g3ta7nyo1VeaL/QwHxGEi/y4AHuzA4AI NgKpz1+//2Dr1BkMDtTmoaLF8Ryx1ERvxFiq3VohsuZEY94wa8L4v8SF7hNpjWKlXRy7 hL8czxvcED1vbcuzK5FMGLBSEziVJqddUjxYYa8YhuVGK8ia7LNwkw2bGS7nZMAfnu8P ZQxrS28vmUrrF4lMsoj460+zX7STUO/tgGu/7ZnnrID3BOSkyvpAZIg17lqJ58xcYasN 5VyzOui3gjJVjL+8yydPqn+fN3dutcl12K+MU4MtYkuFviL02Mq2ahE+s9bxc9I4QpAt 3vzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jtj8h/Gj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l19-20020a635713000000b005b99eb9ea1dsi10565433pgb.441.2023.11.21.09.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 09:49:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jtj8h/Gj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 174688023917; Tue, 21 Nov 2023 09:49:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234364AbjKURsx (ORCPT + 99 others); Tue, 21 Nov 2023 12:48:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbjKURsv (ORCPT ); Tue, 21 Nov 2023 12:48:51 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8466193 for ; Tue, 21 Nov 2023 09:48:47 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6c4eaa5202aso5929910b3a.1 for ; Tue, 21 Nov 2023 09:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588927; x=1701193727; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=U7Rbioe+AA0m1Xzil+Qj4X93APjsim1oxKrG1rmg9wU=; b=jtj8h/Gj/UcUVARWjUu8hsv2XBagNerBCPsxfyimIMsk02UtbmkkJ6NfwvqK0YA1RF YV6rNmVivqMstbTM+l7MFHUVEMV5+SgYMtYHT6QIY0fgiOt/J+q7iKyBZjFqGQH9gTgI ed3fj7YM5RC5g6Gn2ZvlAm5aoFHP6T0jfUNw1Ixshob9ozIyWxJubUtbQh2fRYDxrpaQ o/UBNLmaW2gxvMfvKFLOUtLlVNJ1Q5oytxNPOfG/i6jzlIqd0E2+ICiyGwYWnsfncMhs I4uAwbMlGBP5bmtKqzMaP8QPn6fthkT5W/GR/rjmo7g3JMOl/Ye6eh+I4k4Srx2Xj6eQ /dKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588927; x=1701193727; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U7Rbioe+AA0m1Xzil+Qj4X93APjsim1oxKrG1rmg9wU=; b=S6RNwbHHbaFLF/piKC4HiqUPW2qrrCw0gN9LsfBxkDGY0NMd/CBm8Tt4Rf1EdglTDF raGl9k9y2S/5LRiUPgHXQjajfzqz6c2Uf8oTlxOcG4mIrrmLsWXZVdbQ3JIzj+0s7Uuu DqPF4dPpZDOo7UZN01Wm65zTzZibbpL5t0KiydUfmx7nNT4OMX/Idki6O0Wu7Tnrkvee PRFaR1OjM5hsW5HhikaAF4spzbprtCHIs+pBV9gTgSiTg+xeMKilfRTo3FKVzCyrDcS3 7i+O6/wrJzVWLPgzav3tdfGSaTHe5qUu2TY8iasoZwMRe0Sw4QB9nZAFrvYAouSRf+tg xeUA== X-Gm-Message-State: AOJu0YwdGIG5GlcygLl0cx0idfdJVNsqdrVyi8mJpafiWIuwaOcVQBbw n8EkxMkUbaoo3FY9eM3sIV6nJw== X-Received: by 2002:a05:6a00:15d2:b0:6cb:903a:b064 with SMTP id o18-20020a056a0015d200b006cb903ab064mr9034307pfu.22.1700588927322; Tue, 21 Nov 2023 09:48:47 -0800 (PST) Received: from [172.20.7.39] ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id b11-20020a056a000ccb00b006cb69ff0444sm5547127pfv.151.2023.11.21.09.48.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Nov 2023 09:48:46 -0800 (PST) Message-ID: Date: Tue, 21 Nov 2023 11:48:44 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 14/17] tty: srmcons: use 'count' directly in srmcons_do_write() Content-Language: en-US To: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , "Jiri Slaby (SUSE)" Cc: Greg Kroah-Hartman , linux-serial , LKML , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org References: <20231121092258.9334-1-jirislaby@kernel.org> <20231121092258.9334-15-jirislaby@kernel.org> <4f0db52-6430-9122-1ecc-86e337644944@linux.intel.com> From: Richard Henderson In-Reply-To: <4f0db52-6430-9122-1ecc-86e337644944@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Tue, 21 Nov 2023 09:49:17 -0800 (PST) On 11/21/23 09:21, Ilpo Järvinen wrote: > On Tue, 21 Nov 2023, Jiri Slaby (SUSE) wrote: > >> 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; >> >> /* >> > > The patches in the series are in pretty odd order and it was not told > anywhere here that the return value is unused by the callers. I'd just > reorder the patches. > Agreed, patch 15 needs to be before patch 14. With that, Reviewed-by: Richard Henderson r~