summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/ti-vpe/cal.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-07 00:53:50 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-01-04 12:13:09 +0100
commit2e2279b53a9f48b6bab045a41096dbd781020cdd (patch)
tree6ea3a865232b7ff02c6d092fa14ec60e1aef3ae7 /drivers/media/platform/ti-vpe/cal.c
parentca4fec54f6ba0825532ac21698cf2b7324d02737 (diff)
downloadlinux-2e2279b53a9f48b6bab045a41096dbd781020cdd.tar.bz2
media: ti-vpe: cal: Set cal_dmaqueue.pending to NULL when no pending buffer
When a pending buffer becomes active, the cal_dmaqueue.active field is updated, but the pending field keeps the same value until a new buffer becomes pending. This requires handling the special case of pending == active in different places. Simplify the code by setting the pending field to NULL when the pending buffer becomes active. Buffers are now simply moved from queue to pending and from pending to active. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/ti-vpe/cal.c')
-rw-r--r--drivers/media/platform/ti-vpe/cal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 3e0a69bb7fe5..547dffcfe68f 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -485,8 +485,7 @@ static inline void cal_irq_wdma_start(struct cal_ctx *ctx)
*/
cal_ctx_wr_dma_disable(ctx);
ctx->dma.state = CAL_DMA_STOP_PENDING;
- } else if (!list_empty(&ctx->dma.queue) &&
- ctx->dma.active == ctx->dma.pending) {
+ } else if (!list_empty(&ctx->dma.queue) && !ctx->dma.pending) {
/*
* Otherwise, if a new buffer is available, queue it to the
* hardware.
@@ -519,9 +518,10 @@ static inline void cal_irq_wdma_end(struct cal_ctx *ctx)
}
/* If a new buffer was queued, complete the current buffer. */
- if (ctx->dma.active != ctx->dma.pending) {
+ if (ctx->dma.pending) {
buf = ctx->dma.active;
ctx->dma.active = ctx->dma.pending;
+ ctx->dma.pending = NULL;
}
spin_unlock(&ctx->dma.lock);