Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp239602ybi; Wed, 29 May 2019 20:25:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx58iSo52pKDLxXtZhVRo4lhRxgLUghU6nOw8LBP7Ce8CNWu/oqWQknzEJnmttUAyNKsSwy X-Received: by 2002:a17:902:9689:: with SMTP id n9mr1640152plp.133.1559186753474; Wed, 29 May 2019 20:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186753; cv=none; d=google.com; s=arc-20160816; b=KRWAkeqpDDrjcBl9+SRpo8toO2nITkHEW6iXyc8O0ryWKFupsAQMMrgKfe1/h5SbIJ 7vtON3W6YmlHcWd8fu3nRNEfJk0qxOc7UhWorR2MAmTXnybelsCQLMD9rfbKS9Wq8JdR Pt4Q/qBkHlQx2+S+kYhiHIKfEAAKa4UlBY0ZQd513HxeTnoQ9x/KhpFJBTbpXK26ajbi ACcCT+D8sgdoNGfy1n7CH0aoXQwBGXbmZAkeKxVmhBO2qmhLgPVDelwySV4aKSUDIV3h fND1OkGcZMgx0WB+hKN2pscZAl99Mb5453tcTzcO5ajqPwXcIqOYEZAZoGCA59QI9fJ+ 3tPQ== 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=SC5jB2dBZ7F+8wV1ahUZDBOIZztlHQan1uwnRVxzP3Q=; b=vshEgz+SW8zKuDZcdyayg6W8KY4bJABLtdcIvsuB3WGKO+NdbP8R+xlk44RUpmQhos m2r6XOQgm30TxF5ZVBXXysdBFSSR/XlkEHJvw7UPkE9Z+xYosMPtO4St35laer50MSsQ QJvE/5QEEOOmlOBtmopUKGyuWcRT+yF5jHXexPf4Ms7jVOvl2AnXSnkhzcS+QnRzOz5X +tVieHq4lwoAmMNmv0ZI4L/hl+VlUcJYsRPy7EsOA9o0hy+pmbimf/yWzuE31Gs78dpj P3KUGRSSRk0QcMaPTptZftJ6cHRCEaqRoxJQbkmBOhEBQnJtlvyariiUwG6/wrYRO0Vx TtBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fkGInyCx; 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 o4si1853033pgp.476.2019.05.29.20.25.36; Wed, 29 May 2019 20:25:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fkGInyCx; 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 S1732944AbfE3DWv (ORCPT + 99 others); Wed, 29 May 2019 23:22:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:45110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730923AbfE3DRH (ORCPT ); Wed, 29 May 2019 23:17:07 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (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 BDE8924675; Thu, 30 May 2019 03:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186226; bh=OObzM8KaGnD8+diZDY93AdxdBtxaulkjbCzL+RWyBIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkGInyCxHqcsFh4wk2r2lj5Ebfek7Gg3MX07l7rOhCxATYa86Us8eUTxxoyGNg0cu PuBga9tu4GhaaSWXhSDb0ga0Qjy8wPK7EyLRetYnCKx8uag4x0lDGYZn3r6IWmFS5f R5JQ/YbaZtlTazNnrufQSoRIPpQyXZIyHCE9ZMoE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Shuah Khan , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 123/276] media: au0828: stop video streaming only when last user stops Date: Wed, 29 May 2019 20:04:41 -0700 Message-Id: <20190530030533.533926229@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@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 [ Upstream commit f604f0f5afb88045944567f604409951b5eb6af8 ] If the application was streaming from both videoX and vbiX, and streaming from videoX was stopped, then the vbi streaming also stopped. The cause being that stop_streaming for video stopped the subdevs as well, instead of only doing that if dev->streaming_users reached 0. au0828_stop_vbi_streaming was also wrong since it didn't stop the subdevs at all when dev->streaming_users reached 0. Signed-off-by: Hans Verkuil Tested-by: Shuah Khan Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/au0828/au0828-video.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 62b45062b1e68..72095465856a2 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -839,9 +839,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count) return rc; } + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 1); + if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { - v4l2_device_call_all(&dev->v4l2_dev, 0, video, - s_stream, 1); dev->vid_timeout_running = 1; mod_timer(&dev->vid_timeout, jiffies + (HZ / 10)); } else if (vq->type == V4L2_BUF_TYPE_VBI_CAPTURE) { @@ -861,10 +861,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq) dprintk(1, "au0828_stop_streaming called %d\n", dev->streaming_users); - if (dev->streaming_users-- == 1) + if (dev->streaming_users-- == 1) { au0828_uninit_isoc(dev); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); + } - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); dev->vid_timeout_running = 0; del_timer_sync(&dev->vid_timeout); @@ -893,8 +894,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq) dprintk(1, "au0828_stop_vbi_streaming called %d\n", dev->streaming_users); - if (dev->streaming_users-- == 1) + if (dev->streaming_users-- == 1) { au0828_uninit_isoc(dev); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); + } spin_lock_irqsave(&dev->slock, flags); if (dev->isoc_ctl.vbi_buf != NULL) { -- 2.20.1