Commit 347f2e56 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Simplify atomisp_open() and atomisp_release()

Now that continuous mode is gone and we only have 1 /dev/video# node,
combined with only allowing 1 open of that /dev/video# node for now,
there is no need to check for other (sub)dev / pipe users.

Remove the unnecessary checks for a nice cleanup.

Note we also don't need to set asd->streaming to disabled since
the vb2_fop_release() call done by atomisp_release() will have called
atomisp_stop_streaming() already at this point (if necessary) and
that will have already done this.
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 71a85e05
...@@ -532,11 +532,6 @@ static int atomisp_open(struct file *file) ...@@ -532,11 +532,6 @@ static int atomisp_open(struct file *file)
return -EBUSY; return -EBUSY;
} }
if (atomisp_dev_users(isp)) {
dev_dbg(isp->dev, "skip init isp in open\n");
goto init_subdev;
}
/* runtime power management, turn on ISP */ /* runtime power management, turn on ISP */
ret = pm_runtime_resume_and_get(vdev->v4l2_dev->dev); ret = pm_runtime_resume_and_get(vdev->v4l2_dev->dev);
if (ret < 0) { if (ret < 0) {
...@@ -552,19 +547,12 @@ static int atomisp_open(struct file *file) ...@@ -552,19 +547,12 @@ static int atomisp_open(struct file *file)
goto css_error; goto css_error;
} }
init_subdev:
if (atomisp_subdev_users(asd))
goto done;
atomisp_subdev_init_struct(asd); atomisp_subdev_init_struct(asd);
/* Ensure that a mode is set */ /* Ensure that a mode is set */
v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode); v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode);
done:
pipe->users++; pipe->users++;
mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return 0; return 0;
css_error: css_error:
...@@ -583,7 +571,6 @@ static int atomisp_release(struct file *file) ...@@ -583,7 +571,6 @@ static int atomisp_release(struct file *file)
struct atomisp_sub_device *asd = pipe->asd; struct atomisp_sub_device *asd = pipe->asd;
struct v4l2_subdev_fh fh; struct v4l2_subdev_fh fh;
struct v4l2_rect clear_compose = {0}; struct v4l2_rect clear_compose = {0};
unsigned long flags;
int ret; int ret;
v4l2_fh_init(&fh.vfh, vdev); v4l2_fh_init(&fh.vfh, vdev);
...@@ -598,8 +585,6 @@ static int atomisp_release(struct file *file) ...@@ -598,8 +585,6 @@ static int atomisp_release(struct file *file)
mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
pipe->users--; pipe->users--;
if (pipe->users)
goto done;
/* /*
* A little trick here: * A little trick here:
...@@ -616,9 +601,6 @@ static int atomisp_release(struct file *file) ...@@ -616,9 +601,6 @@ static int atomisp_release(struct file *file)
ATOMISP_SUBDEV_PAD_SINK, &isp_sink_fmt); ATOMISP_SUBDEV_PAD_SINK, &isp_sink_fmt);
} }
if (atomisp_subdev_users(asd))
goto done;
atomisp_css_free_stat_buffers(asd); atomisp_css_free_stat_buffers(asd);
atomisp_free_internal_buffers(asd); atomisp_free_internal_buffers(asd);
...@@ -632,13 +614,6 @@ static int atomisp_release(struct file *file) ...@@ -632,13 +614,6 @@ static int atomisp_release(struct file *file)
isp->inputs[asd->input_curr].asd = NULL; isp->inputs[asd->input_curr].asd = NULL;
} }
spin_lock_irqsave(&isp->lock, flags);
asd->streaming = ATOMISP_DEVICE_STREAMING_DISABLED;
spin_unlock_irqrestore(&isp->lock, flags);
if (atomisp_dev_users(isp))
goto done;
atomisp_destroy_pipes_stream_force(asd); atomisp_destroy_pipes_stream_force(asd);
ret = v4l2_subdev_call(isp->flash, core, s_power, 0); ret = v4l2_subdev_call(isp->flash, core, s_power, 0);
...@@ -648,7 +623,6 @@ static int atomisp_release(struct file *file) ...@@ -648,7 +623,6 @@ static int atomisp_release(struct file *file)
if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0) if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0)
dev_err(isp->dev, "Failed to power off device\n"); dev_err(isp->dev, "Failed to power off device\n");
done:
atomisp_subdev_set_selection(&asd->subdev, fh.state, atomisp_subdev_set_selection(&asd->subdev, fh.state,
V4L2_SUBDEV_FORMAT_ACTIVE, V4L2_SUBDEV_FORMAT_ACTIVE,
ATOMISP_SUBDEV_PAD_SOURCE, ATOMISP_SUBDEV_PAD_SOURCE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment