Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2354031rdg; Mon, 16 Oct 2023 01:22:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDXliCln7HkFLANVipnnWR9Aax84mESq9h6KkZ2JmFKp1oZRrUULQAZfT8QcIPQ3R5WR/4 X-Received: by 2002:a17:903:192:b0:1c8:9bc6:2a09 with SMTP id z18-20020a170903019200b001c89bc62a09mr22838275plg.15.1697444579158; Mon, 16 Oct 2023 01:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697444579; cv=none; d=google.com; s=arc-20160816; b=vPEBBUHPf7l7NY4maEtXi/iDEjIgZHZrFgktaCwKDSDaMEOxPzjBvNfztauPAZB44H /Yq6nB43GBRLPvtQcg27WxwXvTH+5S9HjC9vfaKZLlw9dgixhZjjsPdAVL40TUe9g2cu EmNUSLTKam6bkFY/7SIKZYfTNm08HXV8FkJrh9mOMY7rwir/kdEwR9q5kO46x5otxIhg bzKI7YcN804x/Bn6GgFVAajU3H02JjmeBSVT+9op9ic1ot9IbCjv00JERwjowJZl4Tth kGyrcn4E5gt2t5pWtP/uq2t7zGpkkZFRQziBEtFGoXlncdr4uCT4olnBt7m4ed9HqVHt j3Dw== 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; bh=rUDnQhO9dT5E2FxyVboInO/STwz3ssxaeneCMc6t6ec=; fh=B15rhdDF6y7XVenZygETJZzjECcUXRzvPYm2ZjmD+sQ=; b=UKKMrhSOvOcWP53tZvC1LwnsQu7CUbmNoNTqFizuC6smy+4JzOyueMmRl4w0EnYrRM FQqC8qlLOMqptEGAVc9hxMry0fWQ/plwNEDUBqYslUXZk/keSlaxb713JQbBhHGf6UEC XPRHcfpnNgLsCU/tOSH8M1eIVg52yTnXZzu4gzL6hpmbvvmgGxpd2VWDZROOq874OIuF gl5wa1gTNCh5ivCfs912mToeU0aZV7OWxng+vPilnyHEiCb4olzjvunZqnmLtGE/qcEX jYomrmEGnAbNcVK/K077wQhsW4r/viPWPIhZIesCqySobH6cl1H3p1MLhN5gs6VXLeWM PEDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id k1-20020a170902c40100b001ab29e00303si11298454plk.426.2023.10.16.01.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 01:22:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6355480B2333; Mon, 16 Oct 2023 01:22:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230143AbjJPIWx (ORCPT + 99 others); Mon, 16 Oct 2023 04:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjJPIWw (ORCPT ); Mon, 16 Oct 2023 04:22:52 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16475E5; Mon, 16 Oct 2023 01:22:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CED5C433C7; Mon, 16 Oct 2023 08:22:47 +0000 (UTC) Message-ID: <453d929b-0d6d-4e52-aa7f-454bbf4cac7c@xs4all.nl> Date: Mon, 16 Oct 2023 10:22:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 39/56] touchscreen: sur40: Stop direct calls to queue num_buffers field Content-Language: en-US, nl To: Benjamin Gaignard , mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Dmitry Torokhov , Henrik Rydberg References: <20231012114642.19040-1-benjamin.gaignard@collabora.com> <20231012114642.19040-40-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20231012114642.19040-40-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 01:22:58 -0700 (PDT) On 12/10/2023 13:46, Benjamin Gaignard wrote: > Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. > > Signed-off-by: Benjamin Gaignard > CC: Dmitry Torokhov > CC: Henrik Rydberg > --- > drivers/input/touchscreen/sur40.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c > index 8ddb3f7d307a..e7d2a52169a0 100644 > --- a/drivers/input/touchscreen/sur40.c > +++ b/drivers/input/touchscreen/sur40.c > @@ -847,9 +847,10 @@ static int sur40_queue_setup(struct vb2_queue *q, > unsigned int sizes[], struct device *alloc_devs[]) > { > struct sur40_state *sur40 = vb2_get_drv_priv(q); > + unsigned int q_num_bufs = vb2_get_num_buffers(q); > > - if (q->num_buffers + *nbuffers < 3) > - *nbuffers = 3 - q->num_buffers; > + if (q_num_bufs + *nbuffers < 3) > + *nbuffers = 3 - q_num_bufs; This can just be dropped since this driver sets min_buffers_needed to 3. Regards, Hans > > if (*nplanes) > return sizes[0] < sur40->pix_fmt.sizeimage ? -EINVAL : 0;