From patchwork Mon Aug 5 21:51:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 103315 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from sv.mirrors.kernel.org ([139.178.88.99]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sbi1c-0006kS-0N for patchwork@linuxtv.org; Wed, 07 Aug 2024 14:52:29 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 076E7283B15 for ; Mon, 5 Aug 2024 21:52:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 578DD16F8E8; Mon, 5 Aug 2024 21:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="RdK28723" X-Original-To: linux-media@vger.kernel.org Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 458D116F27E for ; Mon, 5 Aug 2024 21:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894702; cv=none; b=LdTyVD2R0oZb26JF3OGGTMWAPnJZgzaT21/bknQkIP6IHhWc0n1RE75NPheEjcjnX1OFJMUSrJAReWBFYoGeAB3CWZ6OmzzT4dnlV26g+3bjnWfF8xeiSHWWBaaljb5LRl65gTeny0qsJeLp9iusmetOifXnr6slEfM+oeBUZ4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894702; c=relaxed/simple; bh=OgVdtJIy89i09AfBu0oT3OGiDSUpwPVcQctDGe9eoiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rwNyRlQOUWgpReuL/pG2qef9WcYyDEBDpTO4qSL2+FS5pj29QDF9hy7AjMuD93lDtg97RONrZIJP+8iY94R9ZK0+AmXmVvKTofgms6NL0RFHfCjkO+Qiu8Js2AE0FfGqIG/nVCCaO75qHXGBIrphXfpUm/1ddq8cUUDxVaBvSmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=RdK28723; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=n5XKfO5AKcXYHFTAGtk9SFZLBpLN76v4Q2a785qnEaA=; b=RdK287 23dQ1h0tCygqPs03cHKXCZPuaRaDztXbMqKOB5XHtI5+pPGNgedWUJOlwVQjI0GD B4A9oo0vW4E/XBvtwUuXHLLq31WM1ra0L3gbJdARkXHKMxBeE6OmcM0ItbdDZ/7Y J2RLTyPnYMBOlv9FDdesh2FSjr1X+4oktn4ZzFWqunu9ysK+9tHxzCWidVRX1mPj /iJZ/5nJyc8zTid/s9gGZHGKVTT1zQf63a48g2TWm65vEqAd9o4cZwN5JaWk9ACc lZ78eIwjnQlHp91gJvkYSMwdfEpVu9p04PGcHNzZPjlF315imwV7ldyLXXS6NmPF jVkW3aM+Zy+P/RiQ== Received: (qmail 18294 invoked from network); 5 Aug 2024 23:51:33 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:33 +0200 X-UD-Smtp-Session: l3s3148p1@SgMrrvYeCJtehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Benoit Parrot , Mauro Carvalho Chehab Subject: [PATCH v2 8/8] media: ti: cal: use 'time_left' variable with wait_event_timeout() Date: Mon, 5 Aug 2024 23:51:21 +0200 Message-ID: <20240805215123.3528-9-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240805215123.3528-1-wsa+renesas@sang-engineering.com> References: <20240805215123.3528-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-LSpam-Score: -8.6 (--------) X-LSpam-Report: No, score=-8.6 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_MISSING=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_VALIDITY_CERTIFIED=-3,RCVD_IN_VALIDITY_RPBL=1.31,RCVD_IN_VALIDITY_SAFE=-2,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Wolfram Sang --- drivers/media/platform/ti/cal/cal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/ti/cal/cal.c b/drivers/media/platform/ti/cal/cal.c index 528909ae4bd6..5c2c04142aee 100644 --- a/drivers/media/platform/ti/cal/cal.c +++ b/drivers/media/platform/ti/cal/cal.c @@ -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), - msecs_to_jiffies(500)); - if (!timeout) { + time_left = wait_event_timeout(ctx->dma.wait, cal_ctx_wr_dma_stopped(ctx), + msecs_to_jiffies(500)); + if (!time_left) { ctx_err(ctx, "failed to disable dma cleanly\n"); cal_ctx_wr_dma_disable(ctx); }