Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13475132ybl; Sun, 29 Dec 2019 12:48:13 -0800 (PST) X-Google-Smtp-Source: APXvYqyo724WC9jRUxOLkmI/qxmirdKYSNo1HzSULLKTJ2Kgpx/T0AnU448cwcV4T65ML56SDfoe X-Received: by 2002:a9d:7f16:: with SMTP id j22mr68590768otq.256.1577652493699; Sun, 29 Dec 2019 12:48:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652493; cv=none; d=google.com; s=arc-20160816; b=n8N2YfOSMcg9ZtWbfo7Om1hKgOMDRW0I07tbNH5TUdQh2EfzTZc/3S+2vCeuneHMd4 Thnf3VM7QtBxemO70KJeTkL4DWTI35ne+RGt+YdnWo/OaQJVmXTrYZYnRBHwajP/gdFg H+9pVkPjDjGWgW0jGSxcoBTKf5yzMzDm+PgdPkR2Gv5HXOrxk8I969/0lBnFfL+kAZ8R sa55no9tE0l2jViCGMbjqS/8NZvlRfZ9wvD+k4PFaDtPU7UMNXNddBCS37kvZypnkBWH TxhVknQj6ZJLYFieNWVj/7qF29xoSIvbnnbJgLDS117HWns7M6cZIcmNC3i7ZC7bYcCF Exkg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=02Em69RiR9cBw4IConUEat0J5n19ET6fqfyIWBneCAU=; b=pHOQYOxrqg9OzY7WeRQLwPnGYJJg12Y/9DPNsmtvVlNnivQbwEWOQoPIBnboMsx9Tr S3YMhn4wy1XtVBHNbZlE4p0FqzfbmIuLlQHDEW8JHVfZJeW5LuHQcH6+GhZHHWvtQFZS tC+wW9ABbTvCxFwaPW6GTC0C9gU/DDfcFAcLVEoZlR3AfzxTIQqIBhZ+/rW7pgS0+m3L oxNEpSXZasgW/LLCqPOHVXPdVKI3nzaHKGeDYNl47R0kRySGJdRthFkU8oPeJlym82N9 ypAp+kmMPuLhhfi2zlJIrpyUZMzsr3D+/7At+n3HceWQ7pfw38NSZCg1bKMFugOPnEMH uSdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NPoD8wSi; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si13398081oto.207.2019.12.29.12.48.02; Sun, 29 Dec 2019 12:48:13 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=NPoD8wSi; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729741AbfL2Rxm (ORCPT + 99 others); Sun, 29 Dec 2019 12:53:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:40742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732518AbfL2Rxk (ORCPT ); Sun, 29 Dec 2019 12:53:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DCD8821744; Sun, 29 Dec 2019 17:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642019; bh=FlsMQMqOn7IEkO1mex9qV9Ozz9b7EzZBYny40NYvQxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPoD8wSiSPDCQtmtuuu9mwYkmYYfgI6AtsfPoavbuTH2F91i/YQ6lXwQIhemIpAXl peRnbR6aMzoFomuaDqJkQ/fmUWnlOwTaWnwINHkD/Sq2TmEyTwkzfizoVwppWSxEKb GvkN9aT2cmX6ab61Jsnvvy8d7uJoLcZma32Jx0xQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Kocialkowski , Jernej Skrabec , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 281/434] media: cedrus: Use helpers to access capture queue Date: Sun, 29 Dec 2019 18:25:34 +0100 Message-Id: <20191229172720.608456301@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jernej Skrabec [ Upstream commit 1fd50a2c294457508f06b8b631d01a58de81cdd2 ] Accessing capture queue structue directly is not safe. Use helpers for that. Acked-by: Paul Kocialkowski Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/sunxi/cedrus/cedrus.h | 8 ++++++-- drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h index 2f017a651848..3758a1c4e2d0 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h @@ -179,12 +179,16 @@ static inline dma_addr_t cedrus_buf_addr(struct vb2_buffer *buf, static inline dma_addr_t cedrus_dst_buf_addr(struct cedrus_ctx *ctx, int index, unsigned int plane) { - struct vb2_buffer *buf; + struct vb2_buffer *buf = NULL; + struct vb2_queue *vq; if (index < 0) return 0; - buf = ctx->fh.m2m_ctx->cap_q_ctx.q.bufs[index]; + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + if (vq) + buf = vb2_get_buffer(vq, index); + return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0; } diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c index d6a782703c9b..08c6c9c410cc 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c @@ -96,7 +96,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params; const struct v4l2_ctrl_h264_slice_params *slice = run->h264.slice_params; const struct v4l2_ctrl_h264_sps *sps = run->h264.sps; - struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; + struct vb2_queue *cap_q; struct cedrus_buffer *output_buf; struct cedrus_dev *dev = ctx->dev; unsigned long used_dpbs = 0; @@ -104,6 +104,8 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, unsigned int output = 0; unsigned int i; + cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + memset(pic_list, 0, sizeof(pic_list)); for (i = 0; i < ARRAY_SIZE(decode->dpb); i++) { @@ -167,12 +169,14 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, enum cedrus_h264_sram_off sram) { const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params; - struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; + struct vb2_queue *cap_q; struct cedrus_dev *dev = ctx->dev; u8 sram_array[CEDRUS_MAX_REF_IDX]; unsigned int i; size_t size; + cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + memset(sram_array, 0, sizeof(sram_array)); for (i = 0; i < num_ref; i++) { -- 2.20.1