Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp905972rwl; Thu, 10 Aug 2023 03:38:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHYv/sc+wBgwCBMX+OVaapv5rtY+vx9iZUid7JF7Nu0TrGx9MTEJpggxw0lH337qyCkjoI X-Received: by 2002:a17:907:2cf7:b0:992:ef60:aadd with SMTP id hz23-20020a1709072cf700b00992ef60aaddmr2063660ejc.13.1691663915951; Thu, 10 Aug 2023 03:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691663915; cv=none; d=google.com; s=arc-20160816; b=LsDRcDEWKhcirSLTUEtCc+TiBZpgLOIP7lPwq0LMBq6KhYOgfAkh8UHq2soRWLfSq9 LmuVbIVkM8xt1wppu7qmBO9B7qhR0L/q9OGtBYZr4b46eCm68VJp61Jr98sarHVo81EA MNUQSdbzdSUGJ1XL+CVtQWttRXlaiSYSKbDPwBWYD5zlBmaWUblymo2cTumM2aqfPcdX NJBjR/BjRAKkS3jSETiuY7tZT15dwwj457tx3YSejEcK3XYmzvpUhW5GyPNSvSH8fbQ2 tCVXHm0fBUhvryUefT21YcP2Dhn317R5Nx3Z1MNqvd0GeqI4uSWPRY/zOCfnLAW6acxt 8+sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DPLh7fq/Fe4wDkfylhVKPKRu57n0aHzq3eL6f8DTdi8=; fh=BwN/+MC0l7VghJgjmA/BDADcEHy0kAzojsfQP5Zxp9g=; b=tcJW1rjTvn1aFWEaMJF+KP4f4lHTP1UuDHjdWEqRGGaSCNbhonaLvIxpwowX3rk5DO 3QhfO/oUUKeu25KnF2hdW0cN+CHCEXp8QEhvRcol2KCNFvcONHcPnjEv5NvxSbN4ni1z l4eSctyXlSST3fXho36ozTIs2r9qwR9EWCqoJ/FOqX2EUpCzuIgTclXbeFwk6BZOcIP2 GbgEtlQXee2tEHH29Q8IArT7+TgFKfhs7Mm+at38bXP/K2nRuhXS1QVSTVFf6JHKHSeS roBqjg/rhw/3n6j8gODs4LciCUJxArYLYDXNg/V4htse4sI3Kt/1xQhHRRNlouaTnJ6L LEgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3YkisRZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k10-20020a170906680a00b0099cfea2e0ecsi1263848ejr.634.2023.08.10.03.38.11; Thu, 10 Aug 2023 03:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3YkisRZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjHJJmy (ORCPT + 99 others); Thu, 10 Aug 2023 05:42:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjHJJmw (ORCPT ); Thu, 10 Aug 2023 05:42:52 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EADA8DA for ; Thu, 10 Aug 2023 02:42:51 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fe5c0e5747so3889595e9.0 for ; Thu, 10 Aug 2023 02:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691660570; x=1692265370; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DPLh7fq/Fe4wDkfylhVKPKRu57n0aHzq3eL6f8DTdi8=; b=x3YkisRZJi8cG7KHbh8hFPZOL2XvVpY+i5tuJTpHfBML5g8MXHUHVGDoT+aOQ/10wo Cf1S6u/cejfUg+qEz9OV1dGWGuSRv8drvtd8YPmR3/fgIZP45RGhSKaX1pPSE5/Ztf0G Xre1hPjk8aoIIzhYfbbJaZaAnzkVesaecjxgg4g5X1B1ADI+NOXC4iEkPXFz3M9p86ih B6OZcjAO9gOKsRGGh+Tq/YNPCIjjoz9mU6z3odLraYgpabpn3/L1FEngzZXnOMtwXxuv vit2F8aB7xDAunrLeiM70R+igfVSM7yYi5E0SMwGfcBj986bSfGPz/9yvinnO75ceb+L AIKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691660570; x=1692265370; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DPLh7fq/Fe4wDkfylhVKPKRu57n0aHzq3eL6f8DTdi8=; b=he2ofSEIFABHFHpPFksMlGtPB0KVaPWVMg1eV6AIHZcorn6N7VbevjTaZZ+tMAk4q4 hPkAo1JR9TVme8qn/5Q8i1cTsnhPAqiwAHm3vOfriN5fevCa/iEBy4b/RcD7vj2kZd8z lT+c7073PiL2SWfa6y96jXL79AanfijjA4zxEWtIGQo7I73rhtVWFU+QFoth5ueTAs3F EQPbzD4Wjv5rNZrUiQ2nu0flpwg+SF+ZCXqUlh8+0JP6sgGOMK6eAizwq/Wt4HGbaQU7 +eLJ3C48e+iCcqNjMpOtWC6WI9rG+XhZ2GAkIuXkEDilMDOa9ncwsHWfe4qEY7wl1pZb K68w== X-Gm-Message-State: AOJu0Yxog5NBvaphDwHhLMLwKyUC5KsQZjU+2CC8C7X6+G3cPP9Rfc9l 5BWc6Ohhsyf5KN3ZHlESjJla/w== X-Received: by 2002:a05:600c:155:b0:3fe:1166:e33f with SMTP id w21-20020a05600c015500b003fe1166e33fmr1266530wmm.10.1691660570466; Thu, 10 Aug 2023 02:42:50 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id n5-20020a05600c294500b003fbaade0735sm4487947wmd.19.2023.08.10.02.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 02:42:49 -0700 (PDT) Date: Thu, 10 Aug 2023 12:42:47 +0300 From: Dan Carpenter To: "Jiri Slaby (SUSE)" Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH 34/36] tty: gdm724x: convert counts to size_t Message-ID: References: <20230810091510.13006-1-jirislaby@kernel.org> <20230810091510.13006-35-jirislaby@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230810091510.13006-35-jirislaby@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 On Thu, Aug 10, 2023 at 11:15:08AM +0200, Jiri Slaby (SUSE) wrote: > Unify the type of tty_operations::write() counters with the 'count' > parameter. I.e. use size_t for them. > > This includes changing constants to UL to keep min() and avoid min_t(). > > Signed-off-by: Jiri Slaby (SUSE) > Cc: linux-staging@lists.linux.dev > --- > drivers/staging/gdm724x/gdm_tty.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c > index b31f2afb0286..cbaaa8fa7474 100644 > --- a/drivers/staging/gdm724x/gdm_tty.c > +++ b/drivers/staging/gdm724x/gdm_tty.c > @@ -17,9 +17,9 @@ > #define GDM_TTY_MAJOR 0 > #define GDM_TTY_MINOR 32 > > -#define WRITE_SIZE 2048 > +#define WRITE_SIZE 2048UL > > -#define MUX_TX_MAX_SIZE 2048 > +#define MUX_TX_MAX_SIZE 2048UL > > static inline bool gdm_tty_ready(struct gdm *gdm) > { > @@ -152,9 +152,8 @@ static void gdm_tty_send_complete(void *arg) > static ssize_t gdm_tty_write(struct tty_struct *tty, const u8 *buf, size_t len) > { > struct gdm *gdm = tty->driver_data; > - int remain = len; > - int sent_len = 0; > - int sending_len = 0; > + size_t remain = len; We later check if remain <= 0. It still works because remain could never be negative, but now it's even less necessary to check for negatives, I guess. regards, dan carpenter