diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2012-08-14 09:13:40 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-02 16:58:40 (GMT) |
commit | 7fb89eca0f2ad21f6e77f3411cb220ed94f340df (patch) | |
tree | 8aa5f697f6c5f6cbfd85d801b61652728088197c /drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |
parent | f9f715a95d07d3868bb30aeb20252b6b05d35d8f (diff) | |
download | linux-7fb89eca0f2ad21f6e77f3411cb220ed94f340df.tar.xz |
[media] s5p-mfc: optimized code related to working contextes
All code setting/clearing working context bits has been moved
to separate functions. set_bit/clear_bit have been replaced by
non-atomic variants - variable is already guarded by spin_lock.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/s5p-mfc/s5p_mfc_enc.c')
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 075cc5c..179e4db 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -643,11 +643,8 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) spin_unlock_irqrestore(&dev->irqlock, flags); } ctx->state = MFCINST_RUNNING; - if (s5p_mfc_ctx_ready(ctx)) { - spin_lock_irqsave(&dev->condlock, flags); - set_bit(ctx->num, &dev->ctx_work_bits); - spin_unlock_irqrestore(&dev->condlock, flags); - } + if (s5p_mfc_ctx_ready(ctx)) + set_work_bit_irqsave(ctx); s5p_mfc_try_run(dev); return 0; } @@ -755,11 +752,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) vb2_buffer_done(mb_entry->b, VB2_BUF_STATE_DONE); } spin_unlock_irqrestore(&dev->irqlock, flags); - if ((ctx->src_queue_cnt == 0) || (ctx->dst_queue_cnt == 0)) { - spin_lock(&dev->condlock); - clear_bit(ctx->num, &dev->ctx_work_bits); - spin_unlock(&dev->condlock); - } + if ((ctx->src_queue_cnt == 0) || (ctx->dst_queue_cnt == 0)) + clear_work_bit(ctx); return 0; } @@ -922,7 +916,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); struct s5p_mfc_fmt *fmt; struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; - unsigned long flags; int ret = 0; ret = vidioc_try_fmt(file, priv, f); @@ -947,9 +940,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) ctx->dst_bufs_cnt = 0; ctx->capture_state = QUEUE_FREE; s5p_mfc_alloc_instance_buffer(ctx); - spin_lock_irqsave(&dev->condlock, flags); - set_bit(ctx->num, &dev->ctx_work_bits); - spin_unlock_irqrestore(&dev->condlock, flags); + set_work_bit_irqsave(ctx); s5p_mfc_clean_ctx_int_flags(ctx); s5p_mfc_try_run(dev); if (s5p_mfc_wait_for_done_ctx(ctx, \ @@ -1719,15 +1710,11 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) { struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); struct s5p_mfc_dev *dev = ctx->dev; - unsigned long flags; v4l2_ctrl_handler_setup(&ctx->ctrl_handler); /* If context is ready then dev = work->data;schedule it to run */ - if (s5p_mfc_ctx_ready(ctx)) { - spin_lock_irqsave(&dev->condlock, flags); - set_bit(ctx->num, &dev->ctx_work_bits); - spin_unlock_irqrestore(&dev->condlock, flags); - } + if (s5p_mfc_ctx_ready(ctx)) + set_work_bit_irqsave(ctx); s5p_mfc_try_run(dev); return 0; } @@ -1793,11 +1780,8 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb) } else { mfc_err("unsupported buffer type (%d)\n", vq->type); } - if (s5p_mfc_ctx_ready(ctx)) { - spin_lock_irqsave(&dev->condlock, flags); - set_bit(ctx->num, &dev->ctx_work_bits); - spin_unlock_irqrestore(&dev->condlock, flags); - } + if (s5p_mfc_ctx_ready(ctx)) + set_work_bit_irqsave(ctx); s5p_mfc_try_run(dev); } |