From 1057c64d5a4e547cae53e5c466a1d18ea75368bc Mon Sep 17 00:00:00 2001 From: Yong Wang Date: Wed, 24 Oct 2012 08:42:00 +0800 Subject: [PATCH] atomisp: do not do full release if more video pipes are on use The bug (TZSP-3288) is more or less easily reproducible on systems with udev-like software. The helper (v4l_id) is run in parallel for all /dev/videoX nodes twice with only purpose of checking capabilities: ->open("/dev/videoX") ->ioctl(VIDIOC_QUERYCAP) ->release("/dev/videoX") The atomisp_open() call does two stages init of the internal structures. In case of 1st opened node it does full (stage 1 + stage 2) init. Otherwise it is a fast path (stage 1 only). However, atomisp_release() does a fast path for non-main pipes as well. This triggers the unbalanced power management calls: ->open -> stage 1 -> stage 2 -> pm_runtime_get_sync ->release -> stage 1 -> is_main? -> (no) -> fast path The patch is a rough approach to fix this. Any better solution is welcome. Signed-off-by: Andy Shevchenko Tested-by: Yong Wang --- drivers/media/video/atomisp/atomisp_fops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/atomisp/atomisp_fops.c b/drivers/media/video/atomisp/atomisp_fops.c index c6f3ab5..6269828 100644 --- a/drivers/media/video/atomisp/atomisp_fops.c +++ b/drivers/media/video/atomisp/atomisp_fops.c @@ -446,7 +446,9 @@ static int atomisp_release(struct file *file) isp->input_format = NULL; } - if (!pipe->is_main) + if ((isp->isp_subdev.video_out_vf.opened ? 1 : 0) + + (isp->isp_subdev.video_out_mo.opened ? 1 : 0) + + (isp->isp_subdev.video_in.opened ? 1 : 0) > 1) goto done; if (isp->sw_contex.init == false) -- 2.7.4