Skip to content

Commit

Permalink
[media] s5p-fimc: Prevent hanging on device close and fix the locking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent a0f8cae commit 4ecbf5d
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 114 deletions.
9 changes: 2 additions & 7 deletions drivers/media/video/s5p-fimc/fimc-capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,9 @@ static int stop_streaming(struct vb2_queue *q)
{
struct fimc_ctx *ctx = q->drv_priv;
struct fimc_dev *fimc = ctx->fimc_dev;
unsigned long flags;

spin_lock_irqsave(&fimc->slock, flags);
if (!fimc_capture_running(fimc) && !fimc_capture_pending(fimc)) {
spin_unlock_irqrestore(&fimc->slock, flags);
if (!fimc_capture_active(fimc))
return -EINVAL;
}
spin_unlock_irqrestore(&fimc->slock, flags);

return fimc_stop_capture(fimc);
}
Expand Down Expand Up @@ -773,7 +768,7 @@ static int fimc_cap_s_crop(struct file *file, void *fh,
ctx->d_frame.width, ctx->d_frame.height,
ctx->rotation);
if (ret) {
v4l2_err(&fimc->vid_cap.v4l2_dev, "Out of the scaler range");
v4l2_err(&fimc->vid_cap.v4l2_dev, "Out of the scaler range\n");
return ret;
}

Expand Down
Loading

0 comments on commit 4ecbf5d

Please sign in to comment.