Commit c392e9e1 authored by Sascha Hauer's avatar Sascha Hauer Committed by Mauro Carvalho Chehab

[media] media v4l2-mem2mem: Use list_first_entry

Use list_first_entry instead of list_entry which makes the intention
of the code more clear.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Acked-by: default avatarPawel Osciak <pawel@osciak.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 961ae449
...@@ -105,7 +105,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx) ...@@ -105,7 +105,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx)
return NULL; return NULL;
} }
b = list_entry(q_ctx->rdy_queue.next, struct v4l2_m2m_buffer, list); b = list_first_entry(&q_ctx->rdy_queue, struct v4l2_m2m_buffer, list);
spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags);
return &b->vb; return &b->vb;
} }
...@@ -125,7 +125,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx) ...@@ -125,7 +125,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx)
spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags);
return NULL; return NULL;
} }
b = list_entry(q_ctx->rdy_queue.next, struct v4l2_m2m_buffer, list); b = list_first_entry(&q_ctx->rdy_queue, struct v4l2_m2m_buffer, list);
list_del(&b->list); list_del(&b->list);
q_ctx->num_rdy--; q_ctx->num_rdy--;
spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags);
...@@ -178,7 +178,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) ...@@ -178,7 +178,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev)
return; return;
} }
m2m_dev->curr_ctx = list_entry(m2m_dev->job_queue.next, m2m_dev->curr_ctx = list_first_entry(&m2m_dev->job_queue,
struct v4l2_m2m_ctx, queue); struct v4l2_m2m_ctx, queue);
m2m_dev->curr_ctx->job_flags |= TRANS_RUNNING; m2m_dev->curr_ctx->job_flags |= TRANS_RUNNING;
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment