Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp256476ybi; Wed, 29 May 2019 20:47:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1GxRtaY/fmSqm0BfnTvfnKo1o15iLyld0OtNvZz1TSc2iSTu526py68jqLczt/6kVK5mh X-Received: by 2002:a17:90a:b393:: with SMTP id e19mr1446528pjr.91.1559188022797; Wed, 29 May 2019 20:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188022; cv=none; d=google.com; s=arc-20160816; b=Tz9n3fhb2SLPDmqW9O7VFTkxLbCfK/lf7vFJNxj3bf3uzs4IiHl2FWtDgIQaSaopi9 BAX+g47CuaFFUQL8B1P29+UIcgepVI4/vLUEWqmjGftZ2b8PzTxR3aWgzi5gFMh/AGMX lpccfRJU5YEMP/g/MA49Uj8QcxikJeOZTlervRMEX3UrQDiCTkxWkxS35GI9UIOcmH4W zU9EkIpBZLR3pttaOP5s3F4WF8tm0zn7JThM2wFh2NkNEWuowWh6jVicv40Dsdzehchx U9z/eNePZY49XP+dmvvbFPjrvicbaE8N9PGgBi3EkUdg5YVGg6VQM4xLnc6eaKiJXeSm 42ZQ== 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=J/IWc22dDnh+a9MTHwnaq4KGL7T5DrZVCIAiDSpND+Y=; b=Z3h7b1xbhhM0ox2y2srrSdCyCt2kBvjxgSfaPpJmCELzA3ZcqsTf4PQpyB770mWHmP Wki98otHYTTazUkcb/NzXUxHdhbVNKmxmk/TPnFm/jw0/w3B2aDQXOKvjTdFrh5FeWHn WQKoRj/GXNpWWMYo/dxLCVvbncgHoniEPW/FlUnhj7cp6Cm7jlKLrIDMT7PbKWcw/Aud vwdqFASBGtv3wzEFAldvwXo4f0X6QcoupjtdFWIkqNCML9KaT80hCW569/W+YOCXTZwX 7ODY07pmZrfxzDiu6pHnjjS4ZUbNPbidB501iZsb8Xoa0IXkZ1E9AIjQRijnMWjVrkBH PdZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X0SBt07V; 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 n31si510444pjc.5.2019.05.29.20.46.46; Wed, 29 May 2019 20:47:02 -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=X0SBt07V; 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 S1732078AbfE3DpK (ORCPT + 99 others); Wed, 29 May 2019 23:45:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:60166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732362AbfE3DUu (ORCPT ); Wed, 29 May 2019 23:20:50 -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 1767824953; Thu, 30 May 2019 03:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186450; bh=f1dA+bQb+tcOGSWgGeWxyox1dR6ozwf+oOvwxb0UMcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X0SBt07VBOeP2Omy1lHoYz5SRWxHWHjAK3z3unTUQt4r5Mz0HvNNmJGo7xfVt6m22 cIMQ3tv7LfJZ6aFGtNvMRKVssu4q1ZLrxxCZJIs5ySKsdrDFDZjIHx89Xj1SHDh1jO pRBy5JrU8v7askexSMc58hW+RKJEPt9y75ufLwZM= 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.9 059/128] media: au0828: stop video streaming only when last user stops Date: Wed, 29 May 2019 20:06:31 -0700 Message-Id: <20190530030445.434381279@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@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 85dd9a8e83ff1..40594c8a71f4f 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -852,9 +852,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) { @@ -874,10 +874,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); @@ -906,8 +907,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