From patchwork Wed Nov 15 17:59:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10059999 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64FBB60231 for ; Wed, 15 Nov 2017 17:59:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54EE029054 for ; Wed, 15 Nov 2017 17:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49AF92A16E; Wed, 15 Nov 2017 17:59:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85E6829054 for ; Wed, 15 Nov 2017 17:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933328AbdKOR72 (ORCPT ); Wed, 15 Nov 2017 12:59:28 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:42880 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933136AbdKOR72 (ORCPT ); Wed, 15 Nov 2017 12:59:28 -0500 X-Originating-IP: 37.177.52.30 Received: from w540.lan (unknown [37.177.52.30]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 3CB331720AE; Wed, 15 Nov 2017 18:59:25 +0100 (CET) From: Jacopo Mondi To: laurent.pinchart@ideasonboard.com, mchehab@kernel.org, hverkuil@xs4all.nl Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH] v4l: sh_mobile_ceu: Return buffers on streamoff() Date: Wed, 15 Nov 2017 18:59:12 +0100 Message-Id: <1510768752-7588-1-git-send-email-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP videobuf2 core reports an error when not all buffers have been returned to the framework: drivers/media/v4l2-core/videobuf2-core.c:1651 WARN_ON(atomic_read(&q->owned_by_drv_count)) Fix this returning all buffers currently in capture queue. Signed-off-by: Jacopo Mondi --- I know I'm working to get rid of this driver, but while I was trying to have it working again on mainline, I found this had to be fixed. Thanks j --- drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 36762ec..9180a1d 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c @@ -451,13 +451,18 @@ static void sh_mobile_ceu_stop_streaming(struct vb2_queue *q) struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct sh_mobile_ceu_dev *pcdev = ici->priv; struct list_head *buf_head, *tmp; + struct vb2_v4l2_buffer *vbuf; spin_lock_irq(&pcdev->lock); pcdev->active = NULL; - list_for_each_safe(buf_head, tmp, &pcdev->capture) + list_for_each_safe(buf_head, tmp, &pcdev->capture) { + vbuf = &list_entry(buf_head, struct sh_mobile_ceu_buffer, + queue)->vb; + vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE); list_del_init(buf_head); + } spin_unlock_irq(&pcdev->lock);