diff options
author | hoony.yu <hoony.yu@samsung.com> | 2010-10-21 12:25:35 -0700 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-17 17:51:47 -0800 |
commit | b404a1a4df3fd48c2f4a3a058e0a5dce5d12e155 (patch) | |
tree | 66f6f34c58f2b6816732a7af32e2f794355b84b2 /drivers/media | |
parent | 1ebf9b6db197f3cb40189c76e0a7fdb171ca3f02 (diff) | |
download | kernel_samsung_aries-b404a1a4df3fd48c2f4a3a058e0a5dce5d12e155.zip kernel_samsung_aries-b404a1a4df3fd48c2f4a3a058e0a5dce5d12e155.tar.gz kernel_samsung_aries-b404a1a4df3fd48c2f4a3a058e0a5dce5d12e155.tar.bz2 |
S5PC11X: FIMC: add mutex in fimc_release.
- add mutex in fimc_release.
- change from lock to alloc_lock
in fimc_dma_alloc(). and fimc_dma_free().
Change-Id: I4a69208444ef3d7a7ccaf9cb8f0f97f2d482ef10
Signed-off-by: hoony.yu <hoony.yu@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/samsung/fimc/fimc.h | 1 | ||||
-rw-r--r-- | drivers/media/video/samsung/fimc/fimc_dev.c | 29 |
2 files changed, 22 insertions, 8 deletions
diff --git a/drivers/media/video/samsung/fimc/fimc.h b/drivers/media/video/samsung/fimc/fimc.h index 257fce8..8b33814 100644 --- a/drivers/media/video/samsung/fimc/fimc.h +++ b/drivers/media/video/samsung/fimc/fimc.h @@ -379,6 +379,7 @@ struct fimc_control { /* kernel helpers */ struct mutex lock; /* controller lock */ + struct mutex alloc_lock; struct mutex v4l2_lock; wait_queue_head_t wq; struct device *dev; diff --git a/drivers/media/video/samsung/fimc/fimc_dev.c b/drivers/media/video/samsung/fimc/fimc_dev.c index 95548bf..f9d74cf 100644 --- a/drivers/media/video/samsung/fimc/fimc_dev.c +++ b/drivers/media/video/samsung/fimc/fimc_dev.c @@ -43,7 +43,7 @@ int fimc_dma_alloc(struct fimc_control *ctrl, struct fimc_buf_set *bs, { dma_addr_t end, *curr; - mutex_lock(&ctrl->lock); + mutex_lock(&ctrl->alloc_lock); end = ctrl->mem.base + ctrl->mem.size; curr = &ctrl->mem.curr; @@ -69,7 +69,7 @@ int fimc_dma_alloc(struct fimc_control *ctrl, struct fimc_buf_set *bs, } } - mutex_unlock(&ctrl->lock); + mutex_unlock(&ctrl->alloc_lock); return 0; @@ -78,7 +78,7 @@ overflow: bs->length[i] = 0; bs->garbage[i] = 0; - mutex_unlock(&ctrl->lock); + mutex_unlock(&ctrl->alloc_lock); return -ENOMEM; } @@ -86,7 +86,7 @@ overflow: void fimc_dma_free(struct fimc_control *ctrl, struct fimc_buf_set *bs, int i) { int total = bs->length[i] + bs->garbage[i]; - mutex_lock(&ctrl->lock); + mutex_lock(&ctrl->alloc_lock); if (bs->base[i]) { if (ctrl->mem.curr - total >= ctrl->mem.base) @@ -97,7 +97,7 @@ void fimc_dma_free(struct fimc_control *ctrl, struct fimc_buf_set *bs, int i) bs->garbage[i] = 0; } - mutex_unlock(&ctrl->lock); + mutex_unlock(&ctrl->alloc_lock); } void fimc_clk_en(struct fimc_control *ctrl, bool on) @@ -462,6 +462,7 @@ struct fimc_control *fimc_register_controller(struct platform_device *pdev) atomic_set(&ctrl->in_use, 0); mutex_init(&ctrl->lock); + mutex_init(&ctrl->alloc_lock); mutex_init(&ctrl->v4l2_lock); init_waitqueue_head(&ctrl->wq); @@ -508,6 +509,7 @@ static int fimc_unregister_controller(struct platform_device *pdev) free_irq(ctrl->irq, ctrl); mutex_destroy(&ctrl->lock); + mutex_destroy(&ctrl->alloc_lock); mutex_destroy(&ctrl->v4l2_lock); fimc_clk_en(ctrl, false); @@ -961,6 +963,7 @@ static int fimc_release(struct file *filp) pdata = to_fimc_plat(ctrl->dev); + mutex_lock(&ctrl->lock); atomic_dec(&ctrl->in_use); /* FIXME: turning off actual working camera */ @@ -999,13 +1002,15 @@ static int fimc_release(struct file *filp) ret = fimc_init_in_queue(ctrl, ctx); if (ret < 0) { fimc_err("Fail: fimc_init_in_queue\n"); - return -EINVAL; + ret = -EINVAL; + goto release_err; } ret = fimc_init_out_queue(ctrl, ctx); if (ret < 0) { fimc_err("Fail: fimc_init_out_queue\n"); - return -EINVAL; + ret = -EINVAL; + goto release_err; } /* Make all buffers DQUEUED state. */ @@ -1073,15 +1078,23 @@ static int fimc_release(struct file *filp) fimc_err("%s: fb_blank: fb[%d] " \ "mode=FB_BLANK_POWERDOWN\n", __func__, ctx->overlay.fb_id); - return -EINVAL; + ret = -EINVAL; + goto release_err; } ctrl->fb.is_enable = 0; } + mutex_unlock(&ctrl->lock); + fimc_info1("%s released.\n", ctrl->name); return 0; + +release_err: + mutex_unlock(&ctrl->lock); + return ret; + } static const struct v4l2_file_operations fimc_fops = { |