diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2011-02-23 06:24:33 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 03:54:15 -0400 |
commit | 4ecbf5d1d2bb7d1e3882de79e512c1a0a2816581 (patch) | |
tree | 42270272224cdc3532f0923a8317adfecd0d6dcc /drivers/media/video/s5p-fimc/fimc-capture.c | |
parent | a0f8caefaf3295721ef00415c7d63ec10af253ab (diff) |
[media] s5p-fimc: Prevent hanging on device close and fix the locking
Rework the locking in m2m driver to assure proper operation on SMP systems.
When job_abort or stop_streaming was called to immediately shutdown
a memory-to-memory transaction video buffers scheduled for processing
were never returned to vb2 and v4l2_m2m_job_finish was not called
which led to hanging.
Correct this and also return the unprocessed buffers to vb2 marking
them as erroneous, in case the end of frame interrupt do not occur.
Reported-by: Sewoon Park <seuni.park@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-capture.c')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 423931c0cfe5..8312ce465f16 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -252,14 +252,9 @@ static int stop_streaming(struct vb2_queue *q) | |||
252 | { | 252 | { |
253 | struct fimc_ctx *ctx = q->drv_priv; | 253 | struct fimc_ctx *ctx = q->drv_priv; |
254 | struct fimc_dev *fimc = ctx->fimc_dev; | 254 | struct fimc_dev *fimc = ctx->fimc_dev; |
255 | unsigned long flags; | ||
256 | 255 | ||
257 | spin_lock_irqsave(&fimc->slock, flags); | 256 | if (!fimc_capture_active(fimc)) |
258 | if (!fimc_capture_running(fimc) && !fimc_capture_pending(fimc)) { | ||
259 | spin_unlock_irqrestore(&fimc->slock, flags); | ||
260 | return -EINVAL; | 257 | return -EINVAL; |
261 | } | ||
262 | spin_unlock_irqrestore(&fimc->slock, flags); | ||
263 | 258 | ||
264 | return fimc_stop_capture(fimc); | 259 | return fimc_stop_capture(fimc); |
265 | } | 260 | } |
@@ -773,7 +768,7 @@ static int fimc_cap_s_crop(struct file *file, void *fh, | |||
773 | ctx->d_frame.width, ctx->d_frame.height, | 768 | ctx->d_frame.width, ctx->d_frame.height, |
774 | ctx->rotation); | 769 | ctx->rotation); |
775 | if (ret) { | 770 | if (ret) { |
776 | v4l2_err(&fimc->vid_cap.v4l2_dev, "Out of the scaler range"); | 771 | v4l2_err(&fimc->vid_cap.v4l2_dev, "Out of the scaler range\n"); |
777 | return ret; | 772 | return ret; |
778 | } | 773 | } |
779 | 774 | ||