Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1043511ybb; Wed, 25 Mar 2020 14:36:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvuMiLnkar4ErP3eukeUXkQ6JronnDsuemnkXa396rMc/ds7RDJ6sRzF0ViY+tHoMh8SKXq X-Received: by 2002:aca:fd44:: with SMTP id b65mr3749957oii.119.1585172166969; Wed, 25 Mar 2020 14:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585172166; cv=none; d=google.com; s=arc-20160816; b=XtCIuMXfhrLpvgOfVnghxraa7GhiMPWzwjOy/EGei9H5d/YQ1yIy14okjzSTpXRqqw 8+HOgFmkmodXu6gY2xiSnD7ufdsD/XN34D2uDcsnzVIKmhxzfsLtIKzKllhVgkr2KMbp LcoQAMagbzL2a2AP+6LMLayIZuXP6tuWE4D8gQJdwhrLanrBQuLp8AQWsSP0dDaZf9X7 rOyEjfVMoGqOlbaWZh0qnT+tGW3ma0ms/ss06zOm+n3HnWJ9fOLBrWh4I9qC5wATl9/i TGUzTjQv841OKgKWGV6eVlQMx06IZcxdFn6t6GXRkTAzYyzIPQBJJf4B005EXTV1+bCd TRSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=POcZyWMFMETff2UAE2QvzQKrkS/YxrwChi0PmuyZuWw=; b=eMVf0KtcTvZIhPr/RD3D8sGfd+CR7fzVx2QkVzDhFxB/3FFLS5TQb6D2KLfX3kBRCp npDFWFe87VhPizMPj6BR+LXoOJDKRy8W2c8MDY81o4VvyCMsNnBfX5XWCHD9ghdgrlFw FUcyryjJ5djvZZaWqwnmjo4UBjzpLZgtI1en/jOo8nV5v3qARrJws6J2iTF9XLtkNMWJ hx5UnmvgCTj0xe5CbcDBliymFauzK3ODycIpdqUKjgAR5X3H5tilwkijxrHCM9Bk1e+E +NLRIVTa6W0F3C7lLKNuO4/JXj+NoKiyUxNXGqyBOgictKPmGyVYB4tXe6Xvo7RdrBL2 uLZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si163378oti.159.2020.03.25.14.35.54; Wed, 25 Mar 2020 14:36:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727598AbgCYVfN (ORCPT + 99 others); Wed, 25 Mar 2020 17:35:13 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39874 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgCYVfN (ORCPT ); Wed, 25 Mar 2020 17:35:13 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 87055293ECE From: Ezequiel Garcia To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tomasz Figa , Nicolas Dufresne , kernel@collabora.com, Jonas Karlman , Heiko Stuebner , Hans Verkuil , Alexandre Courbot , Jeffrey Kardatzke , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Ezequiel Garcia Subject: [PATCH v3 3/7] hantro: Use v4l2_m2m_buf_done_and_job_finish Date: Wed, 25 Mar 2020 18:34:34 -0300 Message-Id: <20200325213439.16509-4-ezequiel@collabora.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200325213439.16509-1-ezequiel@collabora.com> References: <20200325213439.16509-1-ezequiel@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let the core sort out the nuances of returning buffers to userspace, by using the v4l2_m2m_buf_done_and_job_finish helper. Signed-off-by: Ezequiel Garcia -- drivers/staging/media/hantro/hantro_drv.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index ace13973e2d0..d0097c5fe7d9 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -101,8 +101,8 @@ static void hantro_job_finish(struct hantro_dev *vpu, pm_runtime_put_autosuspend(vpu->dev); clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks); - src = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); - dst = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); + src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); + dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); if (WARN_ON(!src)) return; @@ -112,14 +112,14 @@ static void hantro_job_finish(struct hantro_dev *vpu, src->sequence = ctx->sequence_out++; dst->sequence = ctx->sequence_cap++; - ret = ctx->buf_finish(ctx, &dst->vb2_buf, bytesused); - if (ret) - result = VB2_BUF_STATE_ERROR; - - v4l2_m2m_buf_done(src, result); - v4l2_m2m_buf_done(dst, result); + if (ctx->buf_finish) { + ret = ctx->buf_finish(ctx, &dst->vb2_buf, bytesused); + if (ret) + result = VB2_BUF_STATE_ERROR; + } - v4l2_m2m_job_finish(vpu->m2m_dev, ctx->fh.m2m_ctx); + v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, + result); } void hantro_irq_done(struct hantro_dev *vpu, unsigned int bytesused, -- 2.26.0.rc2