From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CEBBC4332F for ; Fri, 10 Nov 2023 09:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QXqi53ly6UEIv0yzQC2os/TB82um2SmOmh50SqchxK8=; b=i8TmCjLKdI16zYimLVs9T8KHUn 2qJx0tPz5ox1URRlcZ1ohc/snLA7DEKVSA6Ox+Ws1QHjJ3Fzp7tfhfA0DRIpSg3sPCg9Z6DPMuxZX 61Dmcfb6xJGJkiLqTMYiu0eTa6hZD26UeBk/KdBgBQsdHC4jKtcAdGUtERxAmxBrBnSM4/0S6N71E hLsAcHk08EPz9/BTQ9JB3PfCWSrGJ1ivYfScXNJVuIYQeNbq1tCbKC5ShVuU5TdVnfj4dpykRAjSe gsFVkwKOa8oVxdOCleh5I6JIpNvMbrO3/6JxI8QFCCVI69WPuPyPkaFji+MX0F8qOeeJ1Yt29cRXT xlsAUUjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1NnU-008Bf4-1m; Fri, 10 Nov 2023 09:27:28 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1NnR-008Be8-1Z; Fri, 10 Nov 2023 09:27:26 +0000 Received: from [100.116.125.19] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: andrzej.p) by madras.collabora.co.uk (Postfix) with ESMTPSA id 439A666073E2; Fri, 10 Nov 2023 09:27:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699608444; bh=jgC/HX0DCivudpq7G6ihAYUdFIx19Q8cGDVDSrd4fH4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ep3Y5wWKvqdYWq0GuLTK8Omn+oRHjIKlHMyuX6zi3I/dppgmWNgnn3sadX198vWE0 paBGvRYX5NIaY9ihOnNcLvhYDOo88sIE0zi4YSg3buLmuhzRKFC/l3hcMMVPzR+0DG Wa0IfBuWlvuKGUdAAtxyMmV1rGjySZCIh/U0b/xVSSer2H7xPodA+3SCjbV4/O+tM3 Ss0mjgtPPSrT1Uhfux9iAFd/q+s+FvSD7K8Vn18Z8PoXMBi5QRehJ66YnK6k0xD1uU 02xvFLEtdA9RKd3gH6lXIIzDCQ8/LY62h60za2nIkdGdRcaJqbpYz7cfYeJ0tkDjZ5 w4CVFCMnh+8dw== Message-ID: Date: Fri, 10 Nov 2023 10:27:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v15 26/56] media: i2c: video-i2c: Stop direct calls to queue num_buffers field Content-Language: en-US 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, hverkuil-cisco@xs4all.nl, 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, Matt Ranostay References: <20231109163512.179524-14-benjamin.gaignard@collabora.com> <20231109163512.179524-27-benjamin.gaignard@collabora.com> From: Andrzej Pietrasiewicz In-Reply-To: <20231109163512.179524-27-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231110_012725_656836_2752BBDD X-CRM114-Status: GOOD ( 16.11 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org W dniu 9.11.2023 o 17:34, Benjamin Gaignard pisze: > Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. > This allows us to change how the number of buffers is computed in the > future. > Fix the number of buffers computation at the same time. > > Signed-off-by: Benjamin Gaignard Reviewed-by: Andrzej Pietrasiewicz > CC: Matt Ranostay > --- > drivers/media/i2c/video-i2c.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c > index 178bd06cc2ed..ebf2ac98a068 100644 > --- a/drivers/media/i2c/video-i2c.c > +++ b/drivers/media/i2c/video-i2c.c > @@ -405,9 +405,10 @@ static int queue_setup(struct vb2_queue *vq, > { > struct video_i2c_data *data = vb2_get_drv_priv(vq); > unsigned int size = data->chip->buffer_size; > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > > - if (vq->num_buffers + *nbuffers < 2) > - *nbuffers = 2; > + if (q_num_bufs + *nbuffers < 2) > + *nbuffers = 2 - q_num_bufs; > > if (*nplanes) > return sizes[0] < size ? -EINVAL : 0;