Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6788635rdb; Fri, 15 Dec 2023 08:19:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKRkM5aKC6mQgw+QoZJyow8A2v4W5m8Y2208U6+aCwZUhlsmgU+UXe7MgoM8J5Vwr+m4E0 X-Received: by 2002:a05:620a:640e:b0:77f:370b:6011 with SMTP id pz14-20020a05620a640e00b0077f370b6011mr12674643qkn.129.1702657150320; Fri, 15 Dec 2023 08:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702657150; cv=none; d=google.com; s=arc-20160816; b=TKBBK2YOtWQ0rVgHXD/NtMF5pkcpDmEuAvm6u8veUiwJZOh1LtXqhGclf9csiIfQ9E +FCLMrSp22Gnwh05eNmwyZV6602hro2v2xaBxAEsOUDhHg0LWpr4iroXZNMVBD6EpfoS JgJXzsfYWQ++pSDvVckfFOV4JBuCqafSJgqS8YxzOuPEUPCQr+PPr4psGrtdkAtcICIK hLMBeYEl55WJtlcFU5KCmbbRHCYxxms3buNKnNfJxk4TTHss0nZqQYN3fNKErOFv1GQ+ SRxQAc2luoQtXXOBsNCQCHga+LQ2yBRlCdLhSF0tc6G04e3htk0JEZL8Mox4cyU8j3Ob KatQ== 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:dkim-signature; bh=mqnWI6H3xR+X77+L82DguL3IVXDS8TZ9J0FB5BPolzM=; fh=kvdcJCTwf1vcydG1m274qd2tDYYlziXHNGrfAX061SE=; b=hHnBPAALx6KGVfcgFMouC3LXzsazYBx2vn4xmj/X5oME/MedKkkyu/k0QsRttXvCSr TOxu/YeoaEU/SczQPcSxCogaSUGw4kzY+Czlw2JZlKKaL+wYIrDJWJsuzFqC2P/sZpQ9 Xt8RKucStkGJ+jAqJBFfWHAGvw6GzCiN5tkhXeFUOKOah2zlXtEHUs82UkIVpm1vEDMl E9e9Sej8v3HhL8PKIZuBGjX0aI5RDhX6V+cH6LeSwREcnIjj7XkI930GmimeE5DNkp3n UWqOHXDq9/qzYkIug/yl+CGOdBeHEhJ6vk8+swOHJsr13dHMVLwevnbsxlUM8PAFf80x 5J5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K7dm0Ddl; spf=pass (google.com: domain of linux-bluetooth+bounces-614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y13-20020a05620a0e0d00b0077f04e58e77si16209896qkm.205.2023.12.15.08.19.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 08:19:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K7dm0Ddl; spf=pass (google.com: domain of linux-bluetooth+bounces-614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 18ECF1C23976 for ; Fri, 15 Dec 2023 16:19:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F2443C479; Fri, 15 Dec 2023 16:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K7dm0Ddl" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3E853BB25; Fri, 15 Dec 2023 16:18:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46FC0C433C7; Fri, 15 Dec 2023 16:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702657137; bh=YlcNrdt+0bdBjEoeknJhdd+iUZGMaHxrfBZN/74+PSM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K7dm0Ddli65bXnpIe+H/ttDbslFE9q2kMgBadq97OkKtouXQIbEiyY2q9JXScuDsv C1TjFxiht6mfl4VICqLkzK7PUWl+CGRGnU6fYOYPcX8M4yYc9TnjF9ZXpkWsSySLmw CyyhNm54GFYsWjy2rItDi4vwFE9/ZhlLtsFlUG5+pOmeb3j63lrLaKJ7ABlRzd4YHf FIPEL5mBy+6x1p0RKnf9kDaMW13b61pXy/Df0JjpQnoeYrO6LSmIPopfjK9+e6we66 XhmZW3p8qy6Nb89ngBM4O2Sk//rED3kWw0q23oLG3uetyunnmSGJbQZLPq0L+Kbm4x OaRnvmY/t7uxg== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rEAto-0000VW-1C; Fri, 15 Dec 2023 17:18:52 +0100 Date: Fri, 15 Dec 2023 17:18:52 +0100 From: Johan Hovold To: Francesco Dolcini Cc: Greg Kroah-Hartman , 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 =?utf-8?B?SsOkcnZpbmVu?= , 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: On Fri, Dec 15, 2023 at 02:55:59PM +0100, Francesco Dolcini wrote: > 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. > > > -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. Correct. > 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. That driver also knows it will never be negative. And you forgot about drivers/net/ethernet/intel/ice/ice_gnss.c > 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. It's a separate change and should not be hidden away in a tree-wide change that goes through a different maintainer. Please drop this change from this patch and resubmit it separately to me if you want and I'll review when I have the time. And when doing tree-wide changes, please try to follow the style of the driver you are changing (e.g. do not introduce inconsistencies by changing to open parenthesis alignment of continuation lines in code that do not use it). Johan