Message ID | 20231017144756.34719-27-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4188305vqb; Tue, 17 Oct 2023 07:51:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrUijR3lTBuysTQ12fVckNSWZQ1mBE4hE6nWVPnq4Fa36aGRI3DpRimd2Kk4ryo0G/Qd7L X-Received: by 2002:a05:6a00:4809:b0:6b9:7d5c:bb58 with SMTP id di9-20020a056a00480900b006b97d5cbb58mr2518917pfb.0.1697554282905; Tue, 17 Oct 2023 07:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697554282; cv=none; d=google.com; s=arc-20160816; b=oNqcTkLL1mBDj3Yqdm0Ac7eNNADa8kLrDvyho77WaCbAkg8+OuSLn2DuNOjao95ucx v17g1kNpBDoxSithBTv9Dj5czR2Amc6RQD9mKSzlZxhS58ue/awI6t7pVqltM+R8cbXE bLGJTeXi+IbWeUHXkBTHNF8Eiv2XeYzP3OtMqNGczMab5rqkuEPYj3d89cafgW9vlUN6 GNrJsnZO3PeiXBeDYS986WN8l+qx2XljdGFTBx6aIb3zjVtrVZMzacKWd9Emuz8PJV2y Tir8JHZ9gMt24elmbouOcg/OdrCdPBVZbXRuQd6jDlP+lzgGOESO3JiKtTGa/ru3xE0p lPFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=03Fd8kKAqgdMMfzT5XgbPtxOOa7RZzbLW0FBpSwsGTk=; fh=nyy6kl3x7bvRns0O2iGfKgaQnRSGFqx2aqkUiW72Nok=; b=CQmJ5qqxG7BAm0Lqtg1PUxK3KMOtV4zke316pJIJi6XsokKQiRh+Iilr2U1WAAdbJs Geue7ck/54Bt3jICKT8qIkFBmLYk10YGzl4MnW1558kYFpiYDuaCDHu6zHJ9AXXh4qb+ hTmuCoST5x6+LHmBMwgZ2W3rityfBr0EH7wkPERUg2iTZtURSQt9iwml0RY3jXwesmRO S9/NbCsITBIdMF1oWHcmhnnF5Z5Yxtxomu2ex+A1QIvnbfuyAEs9+pLAcTyrisvNdhg+ bH62OmBJeUNtf8UasUW56OriEyywYJhAzVjr7mSZbeRNvDdIetuY+D0OmaWHJk77/znQ g1oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JK66MekY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i13-20020a63e44d000000b00565eb0b2e66si2019767pgk.864.2023.10.17.07.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 07:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JK66MekY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E8A758074687; Tue, 17 Oct 2023 07:50:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344570AbjJQOt6 (ORCPT <rfc822;hjfbswb@gmail.com> + 20 others); Tue, 17 Oct 2023 10:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344242AbjJQOs0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Oct 2023 10:48:26 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881C912A; Tue, 17 Oct 2023 07:48:18 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7205:da49:a7e8:59f8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id ED4AE6607314; Tue, 17 Oct 2023 15:48:16 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697554097; bh=ChpcYCv3I3brbs3IQllzHDZkqVSelhB0M6hpuaYYPs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JK66MekYPCGQJ+2GE5ce8BxsaIsxjT1GPeFyYe/52NRw1tWy67xjxKspeMyUVLap8 T91qerw+IcVbcxhR9y9E4gVjgpPyWPI0mwt9HqIYaSBuj4diCWWuWaKlz+9OtyDST+ Jdm+Le/veYxI9XS2fL5oG+/McilR/T2huCpVlcrhf7V4mePe+uo+exVmc7kkBZhTNR 96aQMp2TCIwyHd4PhKMS1ubQcTkLUzVxbPQuDsGXX5HNlrDZrWvAVJLq6/8cmtyu27 rUTvRdJukYxbWa0D1qXS9M2iEwinTkTYxg1+yloC6aymrooudfMistEnZyOe2S2Q8c +FoMr4hYj8tCw== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> To: 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, Benjamin Gaignard <benjamin.gaignard@collabora.com>, Matt Ranostay <matt.ranostay@konsulko.com> Subject: [PATCH v12 26/56] media: i2c: video-i2c: Stop direct calls to queue num_buffers field Date: Tue, 17 Oct 2023 16:47:26 +0200 Message-Id: <20231017144756.34719-27-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231017144756.34719-1-benjamin.gaignard@collabora.com> References: <20231017144756.34719-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 17 Oct 2023 07:50:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780014679769500432 X-GMAIL-MSGID: 1780014679769500432 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 17, 2023, 2:47 p.m. UTC
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
futur.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
CC: Matt Ranostay <matt.ranostay@konsulko.com>
---
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;