From patchwork Thu Oct 19 12:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 155550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp361275vqb; Thu, 19 Oct 2023 05:58:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERUoDOfgARTtJdzQUXtBIUcn0BAyucBRxlVygJH4gimxNuQFy/RTe3JETBXkH3NfUyflD0 X-Received: by 2002:a05:6830:2b12:b0:6be:fd1c:c228 with SMTP id l18-20020a0568302b1200b006befd1cc228mr2254162otv.1.1697720285451; Thu, 19 Oct 2023 05:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720285; cv=none; d=google.com; s=arc-20160816; b=dUfDunap2rD+AvSJBwmzBIWQx4mQ8sySEQvNdtM3GXw/5AbUWy5nn16CEZhdZ7Mij+ LVBbUAZU5a0EY56eE7bVzjbjHnim+ncsS2GQu4dG15goIDqXMvyoR5RdMOOTELmKxjgT 1pP1MKTYrKqcnwTjDjkGt51EfjMIbQdY9m9/pFbRYtPeMIfvej0iB9b6UnjrU8YQhTSo 8DCHZiuLV5/6fkojSTqpUXFYxbMFrNw/lItaEPkqTRnPzfAIEBRyMB4FvU/h/NoGGFC5 nPtYlw+Wut/d+VcXUt9IvtZ6eXyRKjRE3sacfyIPkjvx7h4EbW6jQXr47lP0ynUam6au a0uw== 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=gJ80uuz21/EmUSmiqLsiqqrA6YfrIBmSGSII/GQns85AAuIc50FnRlhFk+cX4s9ts+ DsZVN6OnQtF6osdlgBBc26kFlgrYx1vQ1jLCFQJPw50XVRdBAhMIItAOeezt+tOG296V sYewDxSLBPHgRgG3mminHKmVRXjNP7QZ34QSfebotDQhSxve26FJlB3dO7DI5oMalElf t5vdSQ3GOBndJmzrngBrQnap+A437lcC5LKSHFa7DfzPymOv82q5JdOz0mlCZvYXwkqV LUzCnX77U9FbiD1WugYtsZzRK1CrhV7UAOO8JJll4M5lyiXJoKYc3uAvcPdab5oe0AtB 6geQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=IGQZ0uEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g16-20020a056a000b9000b0068ff659af62si6421069pfj.106.2023.10.19.05.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=IGQZ0uEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 93EB780732AD; Thu, 19 Oct 2023 05:57:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346125AbjJSMzj (ORCPT + 25 others); Thu, 19 Oct 2023 08:55:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345940AbjJSMxR (ORCPT ); Thu, 19 Oct 2023 08:53:17 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B69C5D4F; Thu, 19 Oct 2023 05:52:51 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (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 E7F206607334; Thu, 19 Oct 2023 13:52:49 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719970; bh=I24/t0ZqSyeKvdZtsSJpVc7QnzmONAbV5k9WYLKmpuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IGQZ0uEQO3rs1XmURBUPRvA8nKSH1kdVUbI7Fn1LiGDupmgB1HYcYEpwrmhpvYHO8 UIbFbDr6MvkbhsNvpvqjGhOcA5paO6TVc+tnHjMOX9OrdO1YmIM9d/5IMPznEVYRjL 4fy+dBFLlCXNtARymxvhg0+cZgraUgyoqB/Vkt1x2/hIGLRPGgsnmFoYnMxdZCF1/l 3w4CVUQlSbAGjjANefzNmGWuPDPFeU4E7R/8EEt5RF3PLZv//XVI66Xdrm95YIdMNu RQiY97kfN+9ZvGU0sGWQkyBp8csYadlaECbKqyJjlLo8efmLH8335ICvO8i4o2d9nX l6DWtTUE2Pxwg== 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 v13 37/56] media: renesas: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:52:03 +0200 Message-Id: <20231019125222.21370-38-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:57:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188745855428336 X-GMAIL-MSGID: 1780188745855428336 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 --- 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);