Re: [PATCH 07/15] media: coda: don't disable IRQs across buffer meta handling

2018-11-14 Thread Philipp Zabel
On Mon, 2018-11-05 at 16:25 +0100, Philipp Zabel wrote:
> From: Lucas Stach 
> 
> 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 

Signed-off-by: Philipp Zabel 

regards
Philipp


[PATCH 07/15] media: coda: don't disable IRQs across buffer meta handling

2018-11-05 Thread Philipp Zabel
From: Lucas Stach 

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 
---
 drivers/media/platform/coda/coda-bit.c| 19 +++
 drivers/media/platform/coda/coda-common.c |  5 ++---
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index ee9d2a402ccd..348b17140715 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -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(>buffer_meta_lock,
- flags);
+   spin_lock(>buffer_meta_lock);
list_add_tail(>list,
  >buffer_meta_list);
ctx->num_metas++;
-   spin_unlock_irqrestore(>buffer_meta_lock,
-  flags);
+   spin_unlock(>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(>buffer_meta_lock, flags);
+   spin_lock(>buffer_meta_lock);
meta = list_first_entry_or_null(>buffer_meta_list,
struct coda_buffer_meta, list);
 
@@ -2007,7 +2003,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
kfifo_in(>bitstream_fifo, buf, pad);
}
}
-   spin_unlock_irqrestore(>buffer_meta_lock, flags);
+   spin_unlock(>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(>buffer_meta_lock, flags);
+   spin_lock(>buffer_meta_lock);
if (!list_empty(>buffer_meta_list)) {
meta = list_first_entry(>buffer_meta_list,
  struct coda_buffer_meta, list);
list_del(>list);
ctx->num_metas--;
-   spin_unlock_irqrestore(>buffer_meta_lock, flags);
+   spin_unlock(>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(>buffer_meta_lock, flags);
+   spin_unlock(>buffer_meta_lock);
v4l2_err(>v4l2_dev, "empty timestamp list!\n");
memset(>frame_metas[decoded_idx], 0,
   sizeof(struct coda_buffer_meta));
diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 54b7344231c0..60b866160094 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1689,7 +1689,6 @@ static void coda_stop_streaming(struct vb2_queue *q)
struct coda_ctx *ctx = vb2_get_drv_priv(q);
struct coda_dev *dev =