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

media: atomisp: Use a normal mutex for the main lock

There is no reason for atomisp to use a rt_mutex instead of a normal
mutex, so switch over to a normal mutex.

All the changes in this patch are just s/rt_mutex/mutex/.

This is a preparation patch for switching the ioctl locking over
to using the video_dev.lock member so that the v4l2-core takes
care of the locking.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 3ad29019
...@@ -1446,10 +1446,10 @@ void atomisp_wdt_work(struct work_struct *work) ...@@ -1446,10 +1446,10 @@ void atomisp_wdt_work(struct work_struct *work)
unsigned int pipe_wdt_cnt[MAX_STREAM_NUM][4] = { {0} }; unsigned int pipe_wdt_cnt[MAX_STREAM_NUM][4] = { {0} };
bool css_recover = true; bool css_recover = true;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (!atomisp_streaming_count(isp)) { if (!atomisp_streaming_count(isp)) {
atomic_set(&isp->wdt_work_queued, 0); atomic_set(&isp->wdt_work_queued, 0);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return; return;
} }
...@@ -1581,7 +1581,7 @@ void atomisp_wdt_work(struct work_struct *work) ...@@ -1581,7 +1581,7 @@ void atomisp_wdt_work(struct work_struct *work)
isp->isp_fatal_error = true; isp->isp_fatal_error = true;
atomic_set(&isp->wdt_work_queued, 0); atomic_set(&isp->wdt_work_queued, 0);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return; return;
} }
} }
...@@ -1601,7 +1601,7 @@ void atomisp_wdt_work(struct work_struct *work) ...@@ -1601,7 +1601,7 @@ void atomisp_wdt_work(struct work_struct *work)
dev_err(isp->dev, "timeout recovery handling done\n"); dev_err(isp->dev, "timeout recovery handling done\n");
atomic_set(&isp->wdt_work_queued, 0); atomic_set(&isp->wdt_work_queued, 0);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
} }
void atomisp_css_flush(struct atomisp_device *isp) void atomisp_css_flush(struct atomisp_device *isp)
...@@ -1861,7 +1861,7 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) ...@@ -1861,7 +1861,7 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr)
* For CSS2.0: we change the way to not dequeue all the event at one * For CSS2.0: we change the way to not dequeue all the event at one
* time, instead, dequue one and process one, then another * time, instead, dequue one and process one, then another
*/ */
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (atomisp_css_isr_thread(isp, frame_done_found, css_pipe_done)) if (atomisp_css_isr_thread(isp, frame_done_found, css_pipe_done))
goto out; goto out;
...@@ -1872,7 +1872,7 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) ...@@ -1872,7 +1872,7 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr)
atomisp_setup_flash(asd); atomisp_setup_flash(asd);
} }
out: out:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
dev_dbg(isp->dev, "<%s\n", __func__); dev_dbg(isp->dev, "<%s\n", __func__);
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -711,7 +711,7 @@ static int atomisp_open(struct file *file) ...@@ -711,7 +711,7 @@ static int atomisp_open(struct file *file)
if (ret) if (ret)
return ret; return ret;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
asd->subdev.devnode = vdev; asd->subdev.devnode = vdev;
/* Deferred firmware loading case. */ /* Deferred firmware loading case. */
...@@ -745,7 +745,7 @@ static int atomisp_open(struct file *file) ...@@ -745,7 +745,7 @@ static int atomisp_open(struct file *file)
*/ */
if (pipe->users) { if (pipe->users) {
dev_dbg(isp->dev, "video node already opened\n"); dev_dbg(isp->dev, "video node already opened\n");
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return -EBUSY; return -EBUSY;
} }
...@@ -788,7 +788,7 @@ static int atomisp_open(struct file *file) ...@@ -788,7 +788,7 @@ static int atomisp_open(struct file *file)
done: done:
pipe->users++; pipe->users++;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
/* 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);
...@@ -799,7 +799,7 @@ static int atomisp_open(struct file *file) ...@@ -799,7 +799,7 @@ static int atomisp_open(struct file *file)
atomisp_css_uninit(isp); atomisp_css_uninit(isp);
pm_runtime_put(vdev->v4l2_dev->dev); pm_runtime_put(vdev->v4l2_dev->dev);
error: error:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
v4l2_fh_release(file); v4l2_fh_release(file);
return ret; return ret;
} }
...@@ -822,7 +822,7 @@ static int atomisp_release(struct file *file) ...@@ -822,7 +822,7 @@ static int atomisp_release(struct file *file)
return -EBADF; return -EBADF;
mutex_lock(&isp->streamoff_mutex); mutex_lock(&isp->streamoff_mutex);
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
dev_dbg(isp->dev, "release device %s\n", vdev->name); dev_dbg(isp->dev, "release device %s\n", vdev->name);
...@@ -905,7 +905,7 @@ static int atomisp_release(struct file *file) ...@@ -905,7 +905,7 @@ static int atomisp_release(struct file *file)
atomisp_subdev_source_pad(vdev), atomisp_subdev_source_pad(vdev),
V4L2_SEL_TGT_COMPOSE, 0, V4L2_SEL_TGT_COMPOSE, 0,
&clear_compose); &clear_compose);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
mutex_unlock(&isp->streamoff_mutex); mutex_unlock(&isp->streamoff_mutex);
return v4l2_fh_release(file); return v4l2_fh_release(file);
...@@ -1063,7 +1063,7 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1063,7 +1063,7 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)
if (!(vma->vm_flags & (VM_WRITE | VM_READ))) if (!(vma->vm_flags & (VM_WRITE | VM_READ)))
return -EACCES; return -EACCES;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (!(vma->vm_flags & VM_SHARED)) { if (!(vma->vm_flags & VM_SHARED)) {
/* Map private buffer. /* Map private buffer.
...@@ -1074,7 +1074,7 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1074,7 +1074,7 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)
*/ */
vma->vm_flags |= VM_SHARED; vma->vm_flags |= VM_SHARED;
ret = hmm_mmap(vma, vma->vm_pgoff << PAGE_SHIFT); ret = hmm_mmap(vma, vma->vm_pgoff << PAGE_SHIFT);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -1117,7 +1117,7 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1117,7 +1117,7 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)
} }
raw_virt_addr->data_bytes = origin_size; raw_virt_addr->data_bytes = origin_size;
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return 0; return 0;
} }
...@@ -1129,12 +1129,12 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1129,12 +1129,12 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)
ret = -EINVAL; ret = -EINVAL;
goto error; goto error;
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return atomisp_videobuf_mmap_mapper(&pipe->capq, vma); return atomisp_videobuf_mmap_mapper(&pipe->capq, vma);
error: error:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -1146,12 +1146,12 @@ static __poll_t atomisp_poll(struct file *file, ...@@ -1146,12 +1146,12 @@ static __poll_t atomisp_poll(struct file *file,
struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_device *isp = video_get_drvdata(vdev);
struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (pipe->capq.streaming != 1) { if (pipe->capq.streaming != 1) {
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return EPOLLERR; return EPOLLERR;
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return videobuf_poll_stream(file, &pipe->capq, pt); return videobuf_poll_stream(file, &pipe->capq, pt);
} }
......
...@@ -238,7 +238,7 @@ struct atomisp_device { ...@@ -238,7 +238,7 @@ struct atomisp_device {
/* Purpose of mutex is to protect and serialize use of isp data /* Purpose of mutex is to protect and serialize use of isp data
* structures and css API calls. */ * structures and css API calls. */
struct rt_mutex mutex; struct mutex mutex;
/* /*
* Serialise streamoff: mutex is dropped during streamoff to * Serialise streamoff: mutex is dropped during streamoff to
* cancel the watchdog queue. MUST be acquired BEFORE * cancel the watchdog queue. MUST be acquired BEFORE
......
...@@ -638,9 +638,9 @@ static int atomisp_g_input(struct file *file, void *fh, unsigned int *input) ...@@ -638,9 +638,9 @@ static int atomisp_g_input(struct file *file, void *fh, unsigned int *input)
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
*input = asd->input_curr; *input = asd->input_curr;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return 0; return 0;
} }
...@@ -663,7 +663,7 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) ...@@ -663,7 +663,7 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (input >= ATOM_ISP_MAX_INPUTS || input >= isp->input_cnt) { if (input >= ATOM_ISP_MAX_INPUTS || input >= isp->input_cnt) {
dev_dbg(isp->dev, "input_cnt: %d\n", isp->input_cnt); dev_dbg(isp->dev, "input_cnt: %d\n", isp->input_cnt);
ret = -EINVAL; ret = -EINVAL;
...@@ -743,12 +743,12 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) ...@@ -743,12 +743,12 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)
asd->input_curr = input; asd->input_curr = input;
/* mark this camera is used by the current stream */ /* mark this camera is used by the current stream */
isp->inputs[input].asd = asd; isp->inputs[input].asd = asd;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return 0; return 0;
error: error:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -831,7 +831,7 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, ...@@ -831,7 +831,7 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
rval = v4l2_subdev_call(camera, pad, enum_mbus_code, NULL, &code); rval = v4l2_subdev_call(camera, pad, enum_mbus_code, NULL, &code);
if (rval == -ENOIOCTLCMD) { if (rval == -ENOIOCTLCMD) {
...@@ -839,7 +839,7 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, ...@@ -839,7 +839,7 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,
"enum_mbus_code pad op not supported by %s. Please fix your sensor driver!\n", "enum_mbus_code pad op not supported by %s. Please fix your sensor driver!\n",
camera->name); camera->name);
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
if (rval) if (rval)
return rval; return rval;
...@@ -952,9 +952,9 @@ static int atomisp_try_fmt_cap(struct file *file, void *fh, ...@@ -952,9 +952,9 @@ static int atomisp_try_fmt_cap(struct file *file, void *fh,
f->fmt.pix.width += pad_w; f->fmt.pix.width += pad_w;
f->fmt.pix.height += pad_h; f->fmt.pix.height += pad_h;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
ret = atomisp_try_fmt(vdev, &f->fmt.pix, NULL); ret = atomisp_try_fmt(vdev, &f->fmt.pix, NULL);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
if (ret) if (ret)
return ret; return ret;
...@@ -969,9 +969,9 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh, ...@@ -969,9 +969,9 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh,
struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_device *isp = video_get_drvdata(vdev);
struct atomisp_video_pipe *pipe; struct atomisp_video_pipe *pipe;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
pipe = atomisp_to_video_pipe(vdev); pipe = atomisp_to_video_pipe(vdev);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
f->fmt.pix = pipe->pix; f->fmt.pix = pipe->pix;
...@@ -993,14 +993,14 @@ static int atomisp_s_fmt_cap(struct file *file, void *fh, ...@@ -993,14 +993,14 @@ static int atomisp_s_fmt_cap(struct file *file, void *fh,
struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_device *isp = video_get_drvdata(vdev);
int ret; int ret;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (isp->isp_fatal_error) { if (isp->isp_fatal_error) {
ret = -EIO; ret = -EIO;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
ret = atomisp_set_fmt(vdev, f); ret = atomisp_set_fmt(vdev, f);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -1224,9 +1224,9 @@ int atomisp_reqbufs(struct file *file, void *fh, ...@@ -1224,9 +1224,9 @@ int atomisp_reqbufs(struct file *file, void *fh,
struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_device *isp = video_get_drvdata(vdev);
int ret; int ret;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
ret = __atomisp_reqbufs(file, fh, req); ret = __atomisp_reqbufs(file, fh, req);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -1267,7 +1267,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1267,7 +1267,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (isp->isp_fatal_error) { if (isp->isp_fatal_error) {
ret = -EIO; ret = -EIO;
goto error; goto error;
...@@ -1366,10 +1366,10 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1366,10 +1366,10 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
pipe->frame_params[buf->index] = NULL; pipe->frame_params[buf->index] = NULL;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
ret = videobuf_qbuf(&pipe->capq, buf); ret = videobuf_qbuf(&pipe->capq, buf);
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (ret) if (ret)
goto error; goto error;
...@@ -1409,7 +1409,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1409,7 +1409,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
asd->pending_capture_request++; asd->pending_capture_request++;
dev_dbg(isp->dev, "Add one pending capture request.\n"); dev_dbg(isp->dev, "Add one pending capture request.\n");
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
dev_dbg(isp->dev, "qbuf buffer %d (%s) for asd%d\n", buf->index, dev_dbg(isp->dev, "qbuf buffer %d (%s) for asd%d\n", buf->index,
vdev->name, asd->index); vdev->name, asd->index);
...@@ -1417,7 +1417,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1417,7 +1417,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
return ret; return ret;
error: error:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -1455,21 +1455,21 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1455,21 +1455,21 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (isp->isp_fatal_error) { if (isp->isp_fatal_error) {
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return -EIO; return -EIO;
} }
if (asd->streaming == ATOMISP_DEVICE_STREAMING_STOPPING) { if (asd->streaming == ATOMISP_DEVICE_STREAMING_STOPPING) {
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
dev_err(isp->dev, "%s: reject, as ISP at stopping.\n", dev_err(isp->dev, "%s: reject, as ISP at stopping.\n",
__func__); __func__);
return -EIO; return -EIO;
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
ret = videobuf_dqbuf(&pipe->capq, buf, file->f_flags & O_NONBLOCK); ret = videobuf_dqbuf(&pipe->capq, buf, file->f_flags & O_NONBLOCK);
if (ret) { if (ret) {
...@@ -1477,7 +1477,7 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1477,7 +1477,7 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
dev_dbg(isp->dev, "<%s: %d\n", __func__, ret); dev_dbg(isp->dev, "<%s: %d\n", __func__, ret);
return ret; return ret;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
buf->bytesused = pipe->pix.sizeimage; buf->bytesused = pipe->pix.sizeimage;
buf->reserved = asd->frame_status[buf->index]; buf->reserved = asd->frame_status[buf->index];
...@@ -1491,7 +1491,7 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) ...@@ -1491,7 +1491,7 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
if (!(buf->flags & V4L2_BUF_FLAG_ERROR)) if (!(buf->flags & V4L2_BUF_FLAG_ERROR))
buf->reserved |= __get_frame_exp_id(pipe, buf) << 16; buf->reserved |= __get_frame_exp_id(pipe, buf) << 16;
buf->reserved2 = pipe->frame_config_id[buf->index]; buf->reserved2 = pipe->frame_config_id[buf->index];
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
dev_dbg(isp->dev, dev_dbg(isp->dev,
"dqbuf buffer %d (%s) for asd%d with exp_id %d, isp_config_id %d\n", "dqbuf buffer %d (%s) for asd%d with exp_id %d, isp_config_id %d\n",
...@@ -1720,7 +1720,7 @@ static int atomisp_streamon(struct file *file, void *fh, ...@@ -1720,7 +1720,7 @@ static int atomisp_streamon(struct file *file, void *fh,
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (isp->isp_fatal_error) { if (isp->isp_fatal_error) {
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -1774,11 +1774,11 @@ static int atomisp_streamon(struct file *file, void *fh, ...@@ -1774,11 +1774,11 @@ static int atomisp_streamon(struct file *file, void *fh,
if (asd->delayed_init == ATOMISP_DELAYED_INIT_QUEUED) { if (asd->delayed_init == ATOMISP_DELAYED_INIT_QUEUED) {
flush_work(&asd->delayed_init_work); flush_work(&asd->delayed_init_work);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
if (wait_for_completion_interruptible( if (wait_for_completion_interruptible(
&asd->init_done) != 0) &asd->init_done) != 0)
return -ERESTARTSYS; return -ERESTARTSYS;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
} }
/* handle per_frame_setting parameter and buffers */ /* handle per_frame_setting parameter and buffers */
...@@ -1938,7 +1938,7 @@ static int atomisp_streamon(struct file *file, void *fh, ...@@ -1938,7 +1938,7 @@ static int atomisp_streamon(struct file *file, void *fh,
asd->delayed_init = ATOMISP_DELAYED_INIT_NOT_QUEUED; asd->delayed_init = ATOMISP_DELAYED_INIT_NOT_QUEUED;
} }
out: out:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -2036,9 +2036,9 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) ...@@ -2036,9 +2036,9 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
if (first_streamoff) { if (first_streamoff) {
/* if other streams are running, should not disable watch dog */ /* if other streams are running, should not disable watch dog */
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
atomisp_wdt_stop(asd, true); atomisp_wdt_stop(asd, true);
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
} }
spin_lock_irqsave(&isp->lock, flags); spin_lock_irqsave(&isp->lock, flags);
...@@ -2188,9 +2188,9 @@ static int atomisp_streamoff(struct file *file, void *fh, ...@@ -2188,9 +2188,9 @@ static int atomisp_streamoff(struct file *file, void *fh,
int rval; int rval;
mutex_lock(&isp->streamoff_mutex); mutex_lock(&isp->streamoff_mutex);
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
rval = __atomisp_streamoff(file, fh, type); rval = __atomisp_streamoff(file, fh, type);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
mutex_unlock(&isp->streamoff_mutex); mutex_unlock(&isp->streamoff_mutex);
return rval; return rval;
...@@ -2225,7 +2225,7 @@ static int atomisp_g_ctrl(struct file *file, void *fh, ...@@ -2225,7 +2225,7 @@ static int atomisp_g_ctrl(struct file *file, void *fh,
if (ret) if (ret)
return ret; return ret;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
switch (control->id) { switch (control->id) {
case V4L2_CID_IRIS_ABSOLUTE: case V4L2_CID_IRIS_ABSOLUTE:
...@@ -2248,7 +2248,7 @@ static int atomisp_g_ctrl(struct file *file, void *fh, ...@@ -2248,7 +2248,7 @@ static int atomisp_g_ctrl(struct file *file, void *fh,
case V4L2_CID_TEST_PATTERN_COLOR_GR: case V4L2_CID_TEST_PATTERN_COLOR_GR:
case V4L2_CID_TEST_PATTERN_COLOR_GB: case V4L2_CID_TEST_PATTERN_COLOR_GB:
case V4L2_CID_TEST_PATTERN_COLOR_B: case V4L2_CID_TEST_PATTERN_COLOR_B:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return v4l2_g_ctrl(isp->inputs[asd->input_curr].camera-> return v4l2_g_ctrl(isp->inputs[asd->input_curr].camera->
ctrl_handler, control); ctrl_handler, control);
case V4L2_CID_COLORFX: case V4L2_CID_COLORFX:
...@@ -2277,7 +2277,7 @@ static int atomisp_g_ctrl(struct file *file, void *fh, ...@@ -2277,7 +2277,7 @@ static int atomisp_g_ctrl(struct file *file, void *fh,
break; break;
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -2310,7 +2310,7 @@ static int atomisp_s_ctrl(struct file *file, void *fh, ...@@ -2310,7 +2310,7 @@ static int atomisp_s_ctrl(struct file *file, void *fh,
if (ret) if (ret)
return ret; return ret;
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
switch (control->id) { switch (control->id) {
case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE:
case V4L2_CID_EXPOSURE: case V4L2_CID_EXPOSURE:
...@@ -2331,7 +2331,7 @@ static int atomisp_s_ctrl(struct file *file, void *fh, ...@@ -2331,7 +2331,7 @@ static int atomisp_s_ctrl(struct file *file, void *fh,
case V4L2_CID_TEST_PATTERN_COLOR_GR: case V4L2_CID_TEST_PATTERN_COLOR_GR:
case V4L2_CID_TEST_PATTERN_COLOR_GB: case V4L2_CID_TEST_PATTERN_COLOR_GB:
case V4L2_CID_TEST_PATTERN_COLOR_B: case V4L2_CID_TEST_PATTERN_COLOR_B:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return v4l2_s_ctrl(NULL, return v4l2_s_ctrl(NULL,
isp->inputs[asd->input_curr].camera-> isp->inputs[asd->input_curr].camera->
ctrl_handler, control); ctrl_handler, control);
...@@ -2363,7 +2363,7 @@ static int atomisp_s_ctrl(struct file *file, void *fh, ...@@ -2363,7 +2363,7 @@ static int atomisp_s_ctrl(struct file *file, void *fh,
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return ret; return ret;
} }
...@@ -2488,9 +2488,9 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, ...@@ -2488,9 +2488,9 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh,
&ctrl); &ctrl);
break; break;
case V4L2_CID_ZOOM_ABSOLUTE: case V4L2_CID_ZOOM_ABSOLUTE:
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
ret = atomisp_digital_zoom(asd, 0, &ctrl.value); ret = atomisp_digital_zoom(asd, 0, &ctrl.value);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
break; break;
case V4L2_CID_G_SKIP_FRAMES: case V4L2_CID_G_SKIP_FRAMES:
ret = v4l2_subdev_call( ret = v4l2_subdev_call(
...@@ -2603,7 +2603,7 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, ...@@ -2603,7 +2603,7 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh,
case V4L2_CID_FLASH_STROBE: case V4L2_CID_FLASH_STROBE:
case V4L2_CID_FLASH_MODE: case V4L2_CID_FLASH_MODE:
case V4L2_CID_FLASH_STATUS_REGISTER: case V4L2_CID_FLASH_STATUS_REGISTER:
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (isp->flash) { if (isp->flash) {
ret = ret =
v4l2_s_ctrl(NULL, isp->flash->ctrl_handler, v4l2_s_ctrl(NULL, isp->flash->ctrl_handler,
...@@ -2618,12 +2618,12 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, ...@@ -2618,12 +2618,12 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh,
asd->params.num_flash_frames = 0; asd->params.num_flash_frames = 0;
} }
} }
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
break; break;
case V4L2_CID_ZOOM_ABSOLUTE: case V4L2_CID_ZOOM_ABSOLUTE:
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
ret = atomisp_digital_zoom(asd, 1, &ctrl.value); ret = atomisp_digital_zoom(asd, 1, &ctrl.value);
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
break; break;
default: default:
ctr = v4l2_ctrl_find(&asd->ctrl_handler, ctrl.id); ctr = v4l2_ctrl_find(&asd->ctrl_handler, ctrl.id);
...@@ -2691,9 +2691,9 @@ static int atomisp_g_parm(struct file *file, void *fh, ...@@ -2691,9 +2691,9 @@ static int atomisp_g_parm(struct file *file, void *fh,
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
parm->parm.capture.capturemode = asd->run_mode->val; parm->parm.capture.capturemode = asd->run_mode->val;
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return 0; return 0;
} }
...@@ -2719,7 +2719,7 @@ static int atomisp_s_parm(struct file *file, void *fh, ...@@ -2719,7 +2719,7 @@ static int atomisp_s_parm(struct file *file, void *fh,
return -EINVAL; return -EINVAL;
} }
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
asd->high_speed_mode = false; asd->high_speed_mode = false;
switch (parm->parm.capture.capturemode) { switch (parm->parm.capture.capturemode) {
...@@ -2761,7 +2761,7 @@ static int atomisp_s_parm(struct file *file, void *fh, ...@@ -2761,7 +2761,7 @@ static int atomisp_s_parm(struct file *file, void *fh,
rval = v4l2_ctrl_s_ctrl(asd->run_mode, mode); rval = v4l2_ctrl_s_ctrl(asd->run_mode, mode);
out: out:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return rval == -ENOIOCTLCMD ? 0 : rval; return rval == -ENOIOCTLCMD ? 0 : rval;
} }
...@@ -2795,7 +2795,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh, ...@@ -2795,7 +2795,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh,
/* we do not need take isp->mutex for these IOCTLs */ /* we do not need take isp->mutex for these IOCTLs */
break; break;
default: default:
rt_mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
break; break;
} }
switch (cmd) { switch (cmd) {
...@@ -3057,7 +3057,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh, ...@@ -3057,7 +3057,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh,
case ATOMISP_IOC_G_UPDATE_EXPOSURE: case ATOMISP_IOC_G_UPDATE_EXPOSURE:
break; break;
default: default:
rt_mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
break; break;
} }
return err; return err;
......
...@@ -1514,7 +1514,7 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i ...@@ -1514,7 +1514,7 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
dev_dbg(&pdev->dev, "atomisp mmio base: %p\n", isp->base); dev_dbg(&pdev->dev, "atomisp mmio base: %p\n", isp->base);
rt_mutex_init(&isp->mutex); mutex_init(&isp->mutex);
mutex_init(&isp->streamoff_mutex); mutex_init(&isp->streamoff_mutex);
spin_lock_init(&isp->lock); spin_lock_init(&isp->lock);
......
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