Commit c80bfa4f authored by Wolfram Sang's avatar Wolfram Sang Committed by Hans Verkuil
Browse files

media: ti: cal: use 'time_left' variable with wait_event_timeout()



There is a confusing pattern in the kernel to use a variable named
'timeout' to store the result of wait_event_timeout() causing
patterns like:

        timeout = wait_event_timeout(...)
        if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the
code self explaining.

Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent f8990669
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -549,7 +549,7 @@ void cal_ctx_start(struct cal_ctx *ctx)
void cal_ctx_stop(struct cal_ctx *ctx)
{
	struct cal_camerarx *phy = ctx->phy;
	long timeout;
	long time_left;

	WARN_ON(phy->vc_enable_count[ctx->vc] == 0);

@@ -565,9 +565,9 @@ void cal_ctx_stop(struct cal_ctx *ctx)
	ctx->dma.state = CAL_DMA_STOP_REQUESTED;
	spin_unlock_irq(&ctx->dma.lock);

	timeout = wait_event_timeout(ctx->dma.wait, cal_ctx_wr_dma_stopped(ctx),
	time_left = wait_event_timeout(ctx->dma.wait, cal_ctx_wr_dma_stopped(ctx),
				       msecs_to_jiffies(500));
	if (!timeout) {
	if (!time_left) {
		ctx_err(ctx, "failed to disable dma cleanly\n");
		cal_ctx_wr_dma_disable(ctx);
	}