From patchwork Tue Oct 31 16:30:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 160217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp365133vqg; Tue, 31 Oct 2023 09:35:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnmZN1eBy/Tv72JEDRuvyF13rvlPVVoUnBqHPm8xelZO9/wkchEaUUbF7aFF1vKAkyJG4f X-Received: by 2002:a17:902:d093:b0:1c5:befa:d81d with SMTP id v19-20020a170902d09300b001c5befad81dmr9695395plv.10.1698770140939; Tue, 31 Oct 2023 09:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770140; cv=none; d=google.com; s=arc-20160816; b=HJEgj7QLizc6P+YCXaoqfNyemTlGJyzCCPVaiYTMgLXR+15TVcqztzRlCtWPYAgfvK 9y2lgv0As3cfea5SIPvIPxOKwZkavEUS23d69WUN4O14LaAEmgCdiy0hD3c8ExxEFS85 ex1NvirHlkx+tbWxmT43OPEwAQj4E7WnOh/nAdOVsNxyCgThRkuW2jA8BRIrhSC/t4VG B4JJjqXHidH5rmqnp7w8Z59FHM/mHy46spIKYMy7X6yl782lDifYSQ8fr8elWkGd+MCl mbEiCVKDiXYkMQ4rWQpV+EdRIClx/ExC1pFFO18BGvUW1D/On9FpEiKT0NK/djmP5vmR EJwA== 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=pSy093gtu6sYylpAu1pxaiVT8mQtQI50EVpPlPpLNJ0=; fh=px7ZZE7zN+iLImfXStSrbDHf67f84nNBK9ImQdNvxt4=; b=c8KruULBmrdQydMzqmt0O5+N7UlWgy/nZHLeAGO+4gDEIn4mIZItlpFAxdMMvgZGt7 Ej1MRUIsyx+E5vSQRQzzn3s4VJnGz5NSHMeY1l8C5GAMD9Zp0hUNUmtcqDE0/R4Sj1lK LtYtOorzajAHUkjvW927HVCAdFJ4u+/NARrcQSs699JYUs9dh4lr79WWerIYU5cIVzLK nw++c8BaptouYb9JHUrR2qdKf5tUf1na0SIPlOma02qsvWrKNTso1ExVi42f3Wa2ret3 7aCLn7PHKclKhWFblmYB/HgPi24yKfPgD9d4g0LE1BS6CPMzeS+iOA4ULgiSjRLU2dfq Q10A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AP4OBUFv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id z11-20020a170903018b00b001cc47e75d58si1251373plg.512.2023.10.31.09.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:35:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AP4OBUFv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 C20C8802D39B; Tue, 31 Oct 2023 09:35:25 -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 S1346512AbjJaQen (ORCPT + 33 others); Tue, 31 Oct 2023 12:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346643AbjJaQeA (ORCPT ); Tue, 31 Oct 2023 12:34:00 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2AA11A3; Tue, 31 Oct 2023 09:32:24 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 E364466073B1; Tue, 31 Oct 2023 16:32:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769942; bh=I24/t0ZqSyeKvdZtsSJpVc7QnzmONAbV5k9WYLKmpuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AP4OBUFvnP886Z6HaoFYtgB0CHHMDFL/TLsU3QaEg9ADHUWMN526rTnUSD4ToZPOv Wx18D/gHbJMVRXMfnA2cRU/Qp8bwGVejYrflKSfkj8xoHN88vzq1OsTf0pRwmww81s 3aqBTrBM6jVkcKL2Fmpi98AWuwgQnSzwu6UqZ/ra/A6GoUzM7cylEi+NwzkgtrUkV6 hhqbTr3sKml6e0CeA2ZyfRpbgWAKP4QU7IWrOpUfiN2GjG0e6DuIP+lEGY0s6rlxpa vDZAhsh0zQKrKmBU/AD7QoTMn7oq5STRYM8/J2s6fQxbE9IcAJZvANgAWtKHCKi97b MxZYQcMh7fm9g== From: Benjamin Gaignard 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 , Fabrizio Castro Subject: [PATCH v14 37/56] media: renesas: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:45 +0100 Message-Id: <20231031163104.112469-38-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: 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, 31 Oct 2023 09:35:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289599374390748 X-GMAIL-MSGID: 1781289599374390748 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. Signed-off-by: Benjamin Gaignard CC: Fabrizio Castro Reviewed-by: Andrzej Pietrasiewicz --- drivers/media/platform/renesas/rcar_drif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rcar_drif.c b/drivers/media/platform/renesas/rcar_drif.c index 292c5bf9e50c..f21d05054341 100644 --- a/drivers/media/platform/renesas/rcar_drif.c +++ b/drivers/media/platform/renesas/rcar_drif.c @@ -424,10 +424,11 @@ static int rcar_drif_queue_setup(struct vb2_queue *vq, unsigned int sizes[], struct device *alloc_devs[]) { struct rcar_drif_sdr *sdr = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); /* Need at least 16 buffers */ - if (vq->num_buffers + *num_buffers < 16) - *num_buffers = 16 - vq->num_buffers; + if (q_num_bufs + *num_buffers < 16) + *num_buffers = 16 - q_num_bufs; *num_planes = 1; sizes[0] = PAGE_ALIGN(sdr->fmt->buffersize);