[media] media v4l2-mem2mem: Use list_first_entry
authorSascha Hauer <s.hauer@pengutronix.de>
Fri, 31 Aug 2012 12:18:03 +0000 (09:18 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 Sep 2012 15:14:05 +0000 (12:14 -0300)
Use list_first_entry instead of list_entry which makes the intention
of the code more clear.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/v4l2-mem2mem.c

index 97b48318aee1826d3ad3bf5225efb93d053b02cc..3ac83583ad7ae5695e3087d2960bc88647c4e501 100644 (file)
@@ -105,7 +105,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx)
                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);
        return &b->vb;
 }
@@ -125,7 +125,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx)
                spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags);
                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);
        q_ctx->num_rdy--;
        spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags);
@@ -178,7 +178,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev)
                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);
        m2m_dev->curr_ctx->job_flags |= TRANS_RUNNING;
        spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);