media: coda: don't disable IRQs across buffer meta handling
authorLucas Stach <l.stach@pengutronix.de>
Mon, 5 Nov 2018 15:25:05 +0000 (10:25 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 23 Nov 2018 10:28:51 +0000 (05:28 -0500)
The CODA driver uses threaded IRQs only, so there is nothing happening
in hardirq context that could interfere with the buffer meta handling.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/coda/coda-bit.c
drivers/media/platform/coda/coda-common.c

index ee9d2a402ccdeaebb885d7404b61e796625465f4..348b1714071514064ac00f9e7f117e212e1d9a76 100644 (file)
@@ -253,7 +253,6 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list)
 {
        struct vb2_v4l2_buffer *src_buf;
        struct coda_buffer_meta *meta;
-       unsigned long flags;
        u32 start;
 
        if (ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG)
@@ -332,13 +331,11 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list)
                                meta->timestamp = src_buf->vb2_buf.timestamp;
                                meta->start = start;
                                meta->end = ctx->bitstream_fifo.kfifo.in;
-                               spin_lock_irqsave(&ctx->buffer_meta_lock,
-                                                 flags);
+                               spin_lock(&ctx->buffer_meta_lock);
                                list_add_tail(&meta->list,
                                              &ctx->buffer_meta_list);
                                ctx->num_metas++;
-                               spin_unlock_irqrestore(&ctx->buffer_meta_lock,
-                                                      flags);
+                               spin_unlock(&ctx->buffer_meta_lock);
 
                                trace_coda_bit_queue(ctx, src_buf, meta);
                        }
@@ -1894,7 +1891,6 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
        struct coda_dev *dev = ctx->dev;
        struct coda_q_data *q_data_dst;
        struct coda_buffer_meta *meta;
-       unsigned long flags;
        u32 rot_mode = 0;
        u32 reg_addr, reg_stride;
 
@@ -1988,7 +1984,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
                coda_write(dev, ctx->iram_info.axi_sram_use,
                                CODA7_REG_BIT_AXI_SRAM_USE);
 
-       spin_lock_irqsave(&ctx->buffer_meta_lock, flags);
+       spin_lock(&ctx->buffer_meta_lock);
        meta = list_first_entry_or_null(&ctx->buffer_meta_list,
                                        struct coda_buffer_meta, list);
 
@@ -2007,7 +2003,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
                        kfifo_in(&ctx->bitstream_fifo, buf, pad);
                }
        }
-       spin_unlock_irqrestore(&ctx->buffer_meta_lock, flags);
+       spin_unlock(&ctx->buffer_meta_lock);
 
        coda_kfifo_sync_to_device_full(ctx);
 
@@ -2029,7 +2025,6 @@ static void coda_finish_decode(struct coda_ctx *ctx)
        struct vb2_v4l2_buffer *dst_buf;
        struct coda_buffer_meta *meta;
        unsigned long payload;
-       unsigned long flags;
        int width, height;
        int decoded_idx;
        int display_idx;
@@ -2161,13 +2156,13 @@ static void coda_finish_decode(struct coda_ctx *ctx)
        } else {
                val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
                val -= ctx->sequence_offset;
-               spin_lock_irqsave(&ctx->buffer_meta_lock, flags);
+               spin_lock(&ctx->buffer_meta_lock);
                if (!list_empty(&ctx->buffer_meta_list)) {
                        meta = list_first_entry(&ctx->buffer_meta_list,
                                              struct coda_buffer_meta, list);
                        list_del(&meta->list);
                        ctx->num_metas--;
-                       spin_unlock_irqrestore(&ctx->buffer_meta_lock, flags);
+                       spin_unlock(&ctx->buffer_meta_lock);
                        /*
                         * Clamp counters to 16 bits for comparison, as the HW
                         * counter rolls over at this point for h.264. This
@@ -2184,7 +2179,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
                        ctx->frame_metas[decoded_idx] = *meta;
                        kfree(meta);
                } else {
-                       spin_unlock_irqrestore(&ctx->buffer_meta_lock, flags);
+                       spin_unlock(&ctx->buffer_meta_lock);
                        v4l2_err(&dev->v4l2_dev, "empty timestamp list!\n");
                        memset(&ctx->frame_metas[decoded_idx], 0,
                               sizeof(struct coda_buffer_meta));
index d9466c2aea19badfb0da12618781356cf56a09b1..5452271cb3a0e44be5a7113503c9fd8250f84c9b 100644 (file)
@@ -1690,7 +1690,6 @@ static void coda_stop_streaming(struct vb2_queue *q)
        struct coda_ctx *ctx = vb2_get_drv_priv(q);
        struct coda_dev *dev = ctx->dev;
        struct vb2_v4l2_buffer *buf;
-       unsigned long flags;
        bool stop;
 
        stop = ctx->streamon_out && ctx->streamon_cap;
@@ -1725,7 +1724,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
                        queue_work(dev->workqueue, &ctx->seq_end_work);
                        flush_work(&ctx->seq_end_work);
                }
-               spin_lock_irqsave(&ctx->buffer_meta_lock, flags);
+               spin_lock(&ctx->buffer_meta_lock);
                while (!list_empty(&ctx->buffer_meta_list)) {
                        meta = list_first_entry(&ctx->buffer_meta_list,
                                                struct coda_buffer_meta, list);
@@ -1733,7 +1732,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
                        kfree(meta);
                }
                ctx->num_metas = 0;
-               spin_unlock_irqrestore(&ctx->buffer_meta_lock, flags);
+               spin_unlock(&ctx->buffer_meta_lock);
                kfifo_init(&ctx->bitstream_fifo,
                        ctx->bitstream.vaddr, ctx->bitstream.size);
                ctx->runcounter = 0;