Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6687134rdb; Fri, 15 Dec 2023 05:56:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIpg5goK5lOM7h60rQm9QmTwRy0Zxf9EPRv2a2QYYt+QtHXWPUVvIX2f5jiDtAmxk3BXbA X-Received: by 2002:ac2:55aa:0:b0:50b:e713:573a with SMTP id y10-20020ac255aa000000b0050be713573amr3570070lfg.74.1702648600290; Fri, 15 Dec 2023 05:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702648600; cv=none; d=google.com; s=arc-20160816; b=ZNo03Kzwcr36hKkRzMWCDUaVSfxtruQmUactKLw1AtJ3+3SLENQ2PmqNTBTyL0xnt9 ugNqaeGMsKTVmc2GT7r/DGSLLH0qJcwk8LTaUDi2qTSy0OCoLtxohrvesSGYZFSVZSex qoc1/I3aNeH6YeJEEyx8Y3q7JziHIcUEgIN4+bSRfNpocPA3zBbggjpyoVrsXyWBSrTe OVIZucNBudrtRSClEOUQtHf1Xa3Y/GBSNo8xy5lg+VYOO5XsTJNnprnn3j2RxEWXs9+f btBpV75RioGTWO4cJr1GYE/BTLMjUj1ddGLQR59FUw8HATilUVcpckJEf0lEdyCFoqou k6eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=qi/HSQcBTgkWdwcBQ0jNqMVNBQZNEmq6pYFwdDEOWmw=; fh=nomr2jIJg9cmIZj+/5BK622n4mVOdRX13Cvfvvwa/0g=; b=WVokgkLXpIkcJqjrTmFuHFwbdcLLeQXPgvZ7ZIkzHTkgbyDq1KjtilY2XRPpoBxUMR 4247y3Ze4JjK0BLfm09RGBai3e5iHfStC6eJwfBfaq0/auCs+PMC9xaWUNNknmUJ2+RW X2rmbNlJhY2qQSbIJ+ybxiOCxSYiDlnN7XvYpDbg8jdFV7QO3QWik+O4aD7v9CjlMUzZ 01HtZllg25b3SQVgo6MZ/kM2oDJ8CC5lRD+P9uKwFd1FRipIgCd+/0f+aVIzU5Kq/O0D MefuaRpcP6oedqyPlw9D7DMvhrFudi6ElUB8wYvFc0B48lROl2qvnGE6PBm21L3c3NVk YVFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-610-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y17-20020a056402271100b00548af200cc7si7308791edd.303.2023.12.15.05.56.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 05:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-610-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0B35D1F23CD3 for ; Fri, 15 Dec 2023 13:56:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A49C83064E; Fri, 15 Dec 2023 13:56:10 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFA3E30328; Fri, 15 Dec 2023 13:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dolcini.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dolcini.it Received: from francesco-nb.int.toradex.com (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 93045212A0; Fri, 15 Dec 2023 14:56:03 +0100 (CET) Date: Fri, 15 Dec 2023 14:55:59 +0100 From: Francesco Dolcini To: Johan Hovold , Greg Kroah-Hartman Cc: Francesco Dolcini , Jiri Slaby , linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, greybus-dev@lists.linaro.org, linux-iio@vger.kernel.org, netdev@vger.kernel.org, chrome-platform@lists.linux.dev, platform-driver-x86@vger.kernel.org, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, Francesco Dolcini , Luiz Augusto von Dentz , Alex Elder , Jonathan Cameron , Lee Jones , Jakub Kicinski , Paolo Abeni , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Hans de Goede , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Benson Leung , Tzung-Bi Shih , Rob Herring Subject: Re: [PATCH v1] treewide, serdev: change receive_buf() return type to size_t Message-ID: References: <20231214170146.641783-1-francesco@dolcini.it> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hello Johan, On Fri, Dec 15, 2023 at 02:36:31PM +0100, Johan Hovold wrote: > On Thu, Dec 14, 2023 at 06:01:46PM +0100, Francesco Dolcini wrote: > > From: Francesco Dolcini > > > > receive_buf() is called from ttyport_receive_buf() that expects values > > ">= 0" from serdev_controller_receive_buf(), change its return type from > > ssize_t to size_t. > > > > Suggested-by: Jiri Slaby > > Link: https://lore.kernel.org/all/087be419-ec6b-47ad-851a-5e1e3ea5cfcc@kernel.org/ > > Signed-off-by: Francesco Dolcini > > --- > > drivers/gnss/core.c | 6 +++--- > > drivers/gnss/serial.c | 4 ++-- > > drivers/gnss/sirf.c | 6 +++--- > > > diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c > > index 48f2ee0f78c4..9b8a0605ec76 100644 > > --- a/drivers/gnss/core.c > > +++ b/drivers/gnss/core.c > > @@ -317,10 +317,10 @@ EXPORT_SYMBOL_GPL(gnss_deregister_device); > > * > > * Must not be called for a closed device. > > */ > > -int gnss_insert_raw(struct gnss_device *gdev, const unsigned char *buf, > > - size_t count) > > +size_t gnss_insert_raw(struct gnss_device *gdev, const unsigned char *buf, > > + size_t count) > > { > > - int ret; > > + size_t ret; > > > > ret = kfifo_in(&gdev->read_fifo, buf, count); > > > > Why are you changing this function? This is part of the GNSS interface > and has nothing to do with the rest of this patch. good point, thanks for looking into that. from my understanding kfifo_in() already return an unsigned, both __kfifo_in and __kfifo_in_r return unsigned. With that said this is used by 3 drivers: = drivers/gnss/sirf.c: = drivers/gnss/serial.c: The driver just use it into the actual receive_buf callback. = drivers/gnss/usb.c This driver does nothing with a negative return value (that is never the less not possible), it just check that the whole buffer was inserted. To me the change is correct, with that said probably this should have been explicitly mentioned in the commit message or a separate preparation patch. Francesco