diff options
author | Jason Liu <r64343@freescale.com> | 2015-05-17 21:56:15 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2015-05-20 20:48:32 +0800 |
commit | 08558cd2b6805ffffa9918fb1a4d19a3686804e6 (patch) | |
tree | b7c1302801f1ecd3ce226c18cacbbb1ed2628f3f | |
parent | 1046f1eb20979cdd874d99601ee889ddf26caf51 (diff) |
MLK-10929 media: mxc: vout: fix the vout->task_lock dead lock issue
with the task_lock mutext to avoid the open/release race condition,
which will have the deadlock issue when the release process try to
destory the workqueue while the display work queued want to get the
task_lock to finish the pending work, this lead to the AB-BA dead lock.
To simplify the design, let's use the dedicated mutext for open/release.
Signed-off-by: Jason Liu <r64343@freescale.com>
(cherry picked from commit 86c9372395b3752a6395639d1ce584b8c79759f7)
-rw-r--r-- | drivers/media/platform/mxc/output/mxc_vout.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/platform/mxc/output/mxc_vout.c b/drivers/media/platform/mxc/output/mxc_vout.c index fd94d3395608..892cf1d8e8be 100644 --- a/drivers/media/platform/mxc/output/mxc_vout.c +++ b/drivers/media/platform/mxc/output/mxc_vout.c @@ -92,6 +92,7 @@ struct mxc_vout_output { struct video_device *vfd; struct mutex mutex; struct mutex task_lock; + struct mutex accs_lock; enum v4l2_buf_type type; struct videobuf_queue vbq; @@ -951,7 +952,7 @@ static int mxc_vout_release(struct file *file) if (!vout) return 0; - mutex_lock(&vout->task_lock); + mutex_lock(&vout->accs_lock); if (--vout->open_cnt == 0) { q = &vout->vbq; if (q->streaming) @@ -964,7 +965,7 @@ static int mxc_vout_release(struct file *file) ret = videobuf_mmap_free(q); } - mutex_unlock(&vout->task_lock); + mutex_unlock(&vout->accs_lock); return ret; } @@ -978,7 +979,7 @@ static int mxc_vout_open(struct file *file) if (vout == NULL) return -ENODEV; - mutex_lock(&vout->task_lock); + mutex_lock(&vout->accs_lock); if (vout->open_cnt++ == 0) { vout->ctrl_rotate = 0; vout->ctrl_vflip = 0; @@ -1012,7 +1013,7 @@ static int mxc_vout_open(struct file *file) file->private_data = vout; err: - mutex_unlock(&vout->task_lock); + mutex_unlock(&vout->accs_lock); return ret; } @@ -2183,6 +2184,7 @@ static int mxc_vout_setup_output(struct mxc_vout_dev *dev) mutex_init(&vout->mutex); mutex_init(&vout->task_lock); + mutex_init(&vout->accs_lock); strlcpy(vout->vfd->name, fbi->fix.id, sizeof(vout->vfd->name)); |