]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/media-au0828-stop-video-streaming-only-when-last-use.patch
drop rdma-cma-consider-scope_id-while-binding-to-ipv6-ll-.patch from 4.4, 4.9, and...
[thirdparty/kernel/stable-queue.git] / queue-4.4 / media-au0828-stop-video-streaming-only-when-last-use.patch
1 From 5d9cbf45e2293a27b7da86c22a96ab8bd33897d3 Mon Sep 17 00:00:00 2001
2 From: Hans Verkuil <hverkuil@xs4all.nl>
3 Date: Tue, 2 Apr 2019 03:24:15 -0400
4 Subject: media: au0828: stop video streaming only when last user stops
5
6 [ Upstream commit f604f0f5afb88045944567f604409951b5eb6af8 ]
7
8 If the application was streaming from both videoX and vbiX, and streaming
9 from videoX was stopped, then the vbi streaming also stopped.
10
11 The cause being that stop_streaming for video stopped the subdevs as well,
12 instead of only doing that if dev->streaming_users reached 0.
13
14 au0828_stop_vbi_streaming was also wrong since it didn't stop the subdevs
15 at all when dev->streaming_users reached 0.
16
17 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
18 Tested-by: Shuah Khan <shuah@kernel.org>
19 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
20 Signed-off-by: Sasha Levin <sashal@kernel.org>
21 ---
22 drivers/media/usb/au0828/au0828-video.c | 13 ++++++++-----
23 1 file changed, 8 insertions(+), 5 deletions(-)
24
25 diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
26 index 7b2fe1b56039e..1ff66e7e26a81 100644
27 --- a/drivers/media/usb/au0828/au0828-video.c
28 +++ b/drivers/media/usb/au0828/au0828-video.c
29 @@ -799,9 +799,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count)
30 return rc;
31 }
32
33 + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 1);
34 +
35 if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
36 - v4l2_device_call_all(&dev->v4l2_dev, 0, video,
37 - s_stream, 1);
38 dev->vid_timeout_running = 1;
39 mod_timer(&dev->vid_timeout, jiffies + (HZ / 10));
40 } else if (vq->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
41 @@ -821,10 +821,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq)
42
43 dprintk(1, "au0828_stop_streaming called %d\n", dev->streaming_users);
44
45 - if (dev->streaming_users-- == 1)
46 + if (dev->streaming_users-- == 1) {
47 au0828_uninit_isoc(dev);
48 + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);
49 + }
50
51 - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);
52 dev->vid_timeout_running = 0;
53 del_timer_sync(&dev->vid_timeout);
54
55 @@ -853,8 +854,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq)
56 dprintk(1, "au0828_stop_vbi_streaming called %d\n",
57 dev->streaming_users);
58
59 - if (dev->streaming_users-- == 1)
60 + if (dev->streaming_users-- == 1) {
61 au0828_uninit_isoc(dev);
62 + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);
63 + }
64
65 spin_lock_irqsave(&dev->slock, flags);
66 if (dev->isoc_ctl.vbi_buf != NULL) {
67 --
68 2.20.1
69