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
......
...@@ -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