From patchwork Mon Aug 5 21:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 817262 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 400A815CD7D for ; Mon, 5 Aug 2024 21:51:33 +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=1722894697; cv=none; b=mdCTHputwMBhSv5p9i/k88UDSj2rt1t/gfkGr5FlRUtKE1DVqFD5LyB6MM6ty6XNo6gjJdGfkfd1VgaCBNL6zji/+/lNCfNEyL8y7JfZAkMPAaW4skSSA4tDgRDS7+duVCZ71tMafos85rQE1GZqhOMYi+w8IZvgaXYWH1XieDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894697; c=relaxed/simple; bh=1BuPzu8VD/zUyF4FZmBltGkSc6FmT/9fdSLZIAgjdl4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W8owbPB9A9aoRsSdxWUUEPVfmpbH6oEe4gLShUAaJf3/q5XDGSSxTnBmQ/BKhCgSIL1EqoDgvCNMmuCno4aOQE0Faamd2XUpFDaOkDxxUon8xd3jcLuB+bC3GZCgiBmcP+I6eFwSJyIAnS3DcBFxgHrEfA/rI6tRkPu5N2VIez0= 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=DHLVoPAo; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="DHLVoPAo" 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=SrhVEbjx9gkbi4ohYgYEDx9IsxwINCJckP5iaY5Xll4=; b=DHLVoP Ao2rhyJ15b5Sip306Yq37wUfChPR9bsoMSPb44bjw82jGOl6yPHuxvADPGe3DPMo DykYEcjWLeqcvJQJCsIc5FW4ljDu3VnvN7t1Li5TGTN71RR29h6mV4kTYRzs+c2d nUE2SKPy5SO+KtXOyOf9YWzILYr+ywHpIRkFHXkT8UmayTXAjhvKnhhV53VOo5oi pnkU6B0k7p+938Dh7MaR1KdUFllAR8N2xCsglqOWiybPY4YpJlOe4mwuz2fDcGLm Pdn6wl0ATgz+hkxivl5zfbpn1ogdJRg7dOkN8ePPBET0lGGdFZBWGjDvgFG42JHo hZPRAzKcSP/ru80g== Received: (qmail 18099 invoked from network); 5 Aug 2024 23:51:26 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:26 +0200 X-UD-Smtp-Session: l3s3148p1@/iXBrfYe5JRehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Michael Tretter , Pengutronix Kernel Team , Mauro Carvalho Chehab Subject: [PATCH v2 1/8] media: allegro: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 5 Aug 2024 23:51:14 +0200 Message-ID: <20240805215123.3528-2-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 There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining, also for the code path using 'tmo' as a variable. Signed-off-by: Wolfram Sang Reviewed-by: Michael Tretter --- Change since v1: * fixed the 'tmo' variable as well .../media/platform/allegro-dvt/allegro-core.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c index da61f9beb6b4..0142ba175198 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -1415,11 +1415,11 @@ static int allegro_mcu_send_encode_frame(struct allegro_dev *dev, static int allegro_mcu_wait_for_init_timeout(struct allegro_dev *dev, unsigned long timeout_ms) { - unsigned long tmo; + unsigned long time_left; - tmo = wait_for_completion_timeout(&dev->init_complete, - msecs_to_jiffies(timeout_ms)); - if (tmo == 0) + time_left = wait_for_completion_timeout(&dev->init_complete, + msecs_to_jiffies(timeout_ms)); + if (time_left == 0) return -ETIMEDOUT; reinit_completion(&dev->init_complete); @@ -2481,14 +2481,14 @@ static void allegro_mcu_interrupt(struct allegro_dev *dev) static void allegro_destroy_channel(struct allegro_channel *channel) { struct allegro_dev *dev = channel->dev; - unsigned long timeout; + unsigned long time_left; if (channel_exists(channel)) { reinit_completion(&channel->completion); allegro_mcu_send_destroy_channel(dev, channel); - timeout = wait_for_completion_timeout(&channel->completion, - msecs_to_jiffies(5000)); - if (timeout == 0) + time_left = wait_for_completion_timeout(&channel->completion, + msecs_to_jiffies(5000)); + if (time_left == 0) v4l2_warn(&dev->v4l2_dev, "channel %d: timeout while destroying\n", channel->mcu_channel_id); @@ -2544,7 +2544,7 @@ static void allegro_destroy_channel(struct allegro_channel *channel) static int allegro_create_channel(struct allegro_channel *channel) { struct allegro_dev *dev = channel->dev; - unsigned long timeout; + unsigned long time_left; if (channel_exists(channel)) { v4l2_warn(&dev->v4l2_dev, @@ -2595,9 +2595,9 @@ static int allegro_create_channel(struct allegro_channel *channel) reinit_completion(&channel->completion); allegro_mcu_send_create_channel(dev, channel); - timeout = wait_for_completion_timeout(&channel->completion, - msecs_to_jiffies(5000)); - if (timeout == 0) + time_left = wait_for_completion_timeout(&channel->completion, + msecs_to_jiffies(5000)); + if (time_left == 0) channel->error = -ETIMEDOUT; if (channel->error) goto err; From patchwork Mon Aug 5 21:51:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 816898 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 2C8DC16B39C for ; Mon, 5 Aug 2024 21:51:34 +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=1722894697; cv=none; b=k0DrgRl6HWkUYdFpeZNE/xLuzZP9xINaFnjLkgkuMqkJFZNfQTP9Fr3zYx12uyx73pMWeUMv0wGhQO/s/D3a5QCKLuOKVL3NDDiGpooH7TCWPIMzQeNT2d/b85J7NbbK8NkfgF/auSJOSMeeBJtQ4XA6Kqg3fFqgwMZ7sdVW4Bg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894697; c=relaxed/simple; bh=6Dw6/Wq/G9/iJ+th9YS1xD5AfeJke+HEoIUu5IoZ92w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b0wNglLwH6Z9fOE/7lDeOhv48rIMLufQlpgLPrBNR8EKETTs9lf1jNi47WVxgb//x6Xuk9ciOCTC77hFKj7gv5FZRuaNFpwGsfhBgE9nEVdaDk7J15miX4zLbB/7gbb/A7yTL/+fIk3VzmQLAyPq9CRmAL44YTuV4kMreKu0H5g= 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=VsaEc5W4; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="VsaEc5W4" 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=7loi66eWoM4pglv0+trIoRx+8rGoC+Ly/55TuGaEhSQ=; b=VsaEc5 W46msxU/DpeVVdyZcGKvIzaPRjQc2z2+g1hbevug0L0W8S1DRX06eh4J2MTNPmml 9hdhpI3j2KNR74ijArlBYUQ2ZAPrsjstzFc45MS0xU6Zf5AfMhMftZpfXbTiPXOO JiQ3JgJ++YOmTBzmaVYn8UM+oQQKw/NTqrIB5Y5K9TscE6WDgD7089yZuzAQCAeg h2tTkco086vicAb5WI3rlTQDpIMyj3tgzojydU3Qkb/sLdtnB3QWe9LPIy4x/TZH qb9Bqoos78f3F5n8V5iDD7daRm4thzO0uwXltKJMGTGQM1yiVdeqSAqezzEoffqL xlAfwk9LPj4j7wYg== Received: (qmail 18128 invoked from network); 5 Aug 2024 23:51:27 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:27 +0200 X-UD-Smtp-Session: l3s3148p1@qPPNrfYe8pRehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Eugen Hristev , Mauro Carvalho Chehab , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/8] media: atmel-isi: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 5 Aug 2024 23:51:15 +0200 Message-ID: <20240805215123.3528-3-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 There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_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/atmel/atmel-isi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index c1108df72dd5..5c823d3f9cc0 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -242,7 +242,7 @@ static irqreturn_t isi_interrupt(int irq, void *dev_id) #define WAIT_ISI_DISABLE 0 static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset) { - unsigned long timeout; + unsigned long time_left; /* * The reset or disable will only succeed if we have a * pixel clock from the camera. @@ -257,9 +257,9 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset) isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); } - timeout = wait_for_completion_timeout(&isi->complete, - msecs_to_jiffies(500)); - if (timeout == 0) + time_left = wait_for_completion_timeout(&isi->complete, + msecs_to_jiffies(500)); + if (time_left == 0) return -ETIMEDOUT; return 0; From patchwork Mon Aug 5 21:51:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 816896 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 8C6D916C426 for ; Mon, 5 Aug 2024 21:51:36 +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=1722894698; cv=none; b=SIw6Qt09UnmEFeERiBARhsGv9xg73KUCOlMWx2J99nDkTVDw34AfB/wx8/zrK8y3+McOBQq6Yhv7PgzwaVMwnIG1w1FbiQheF9FwtRQ587+n6HQ0CVDmkEEdQEy+bk09yq3pJ3uCSM9ItRFTSCsMU0Zy2cn54iL7p0y9ecN8aJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894698; c=relaxed/simple; bh=/A2DVhDVexGPPrWxZFYZsP7zHQG3D+JUkumdN+zLqIY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PWV8HheIcurLu/6dHsGHROp+pLIwqUEr45cjpjbLvf8CPeSZuVYKwxMX3hOZ5YmvFX+jkhurABIExsl9XdUMq9R6x1kE9BjliaXdmOeuE8YBd4XUB3NTW/w/Gy+jm9A2/zeuUtX7axg/fUtaZZs/lrOctATBG3Qj8q6laYjZaQs= 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=bZ1TayCK; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="bZ1TayCK" 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=w538hv4tbbmuuhA3G35elCTLRVa2Gr7H7WrZttJZ8y0=; b=bZ1Tay CKs+7TMW57bLc7CdZA7KJULkP7PfD0oWgooRkub2KO6mmT/lrXO6RkYB8FKiygxt 3K76NrGidMFdT2Kq03vnnll6zNJrTXPIkq+pnVd2ljYShFqhl+0xJAkGDpmOd/Qh rYWxOeFSJX9DIrl5iaSNKs2uxnvSyFPo3y0HAnLbFSUUvOmCUbai4B4za+iAV2fS vlD/8mu7OFXzJWZih5q/oyQptx3E0JN9sZ/sFNYj5aznJ6b5fP695ynjtv80bxYi b0pdojsWT55rKegWz9Ei7TXbe0iSGKgBVZkZ7nuVBICZES3bVovsa0N8g4Tc/oZa S+wrWIgqOZ/5P8Jw== Received: (qmail 18160 invoked from network); 5 Aug 2024 23:51:28 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:28 +0200 X-UD-Smtp-Session: l3s3148p1@ndHZrfYe2JpehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Fabien Dessenne , Mauro Carvalho Chehab Subject: [PATCH v2 3/8] media: bdisp: use 'time_left' variable with wait_event_timeout() Date: Mon, 5 Aug 2024 23:51:16 +0200 Message-ID: <20240805215123.3528-4-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 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. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang --- drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c index 1328b4eb6b9f..c7ee6e1a4451 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -1160,7 +1160,7 @@ static void bdisp_irq_timeout(struct work_struct *ptr) static int bdisp_m2m_suspend(struct bdisp_dev *bdisp) { unsigned long flags; - int timeout; + long time_left; spin_lock_irqsave(&bdisp->slock, flags); if (!test_bit(ST_M2M_RUNNING, &bdisp->state)) { @@ -1171,13 +1171,13 @@ static int bdisp_m2m_suspend(struct bdisp_dev *bdisp) set_bit(ST_M2M_SUSPENDING, &bdisp->state); spin_unlock_irqrestore(&bdisp->slock, flags); - timeout = wait_event_timeout(bdisp->irq_queue, - test_bit(ST_M2M_SUSPENDED, &bdisp->state), - BDISP_WORK_TIMEOUT); + time_left = wait_event_timeout(bdisp->irq_queue, + test_bit(ST_M2M_SUSPENDED, &bdisp->state), + BDISP_WORK_TIMEOUT); clear_bit(ST_M2M_SUSPENDING, &bdisp->state); - if (!timeout) { + if (!time_left) { dev_err(bdisp->dev, "%s IRQ timeout\n", __func__); return -EAGAIN; } From patchwork Mon Aug 5 21:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 817261 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 8AD07165F1B for ; Mon, 5 Aug 2024 21:51:36 +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=1722894698; cv=none; b=CnLbcXEv274DDO1ZubffrQel4BjEIeDpwIqCjc1uQo9mX21AAVUOP7Ll2APO7Fc/MNl9EI6yh4hoe8X0O2+UCI+pctLmdbjA3ZYvzKvYR3CSY+1wG1w8yE3DZHxR5/xXmNlOBbOSKi6fz1oLlAgFna+GR9gLki1JrpplbI8xOhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894698; c=relaxed/simple; bh=nJ1vUo2Ufp68zcuf1iqmoZKx5P1bR6GonT+G1DeZl7o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xw8ykEux5cw4OQ+EVhAnW5gaXthvBLgmOPA20FG/ANVoUkwHCXf0go7zY+aUVoZbgfyyYCLMXEU2I6kHEMb56SjY6FDKJvkm9mDD5N2AIa1bnsgcM5fvwMMqt1+3VFF3jDNOe168gsPYr9H3hrpgd2e09VMxOU7KmapFYUEpSUI= 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=h4t1huwM; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="h4t1huwM" 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=LKaIkakCgP1OJn4iZqkkYHeziSGxZPmIwKaM52VVkTg=; b=h4t1hu wMTsC9qc3C62TVIeqEMaY8+r5sMMSzM6uVLCks/6/s2gcfVmHLWFGslDo+/DL5ZX 8fQBRD0bx/TH7ibjtPGxRsYfZFSRsbyQR5PD5PEK2krIinLg/vyrTuPycKaSe6nQ 0antjRyQ4njYi/5T+hdQDPFZWzPuE87Kgnmsb58fZ15aO71Vou28g//dj601/bwU xkpQIKrIGdXN5JXM38nsQAtDDU2UPkJ0yZpP4RC1U1nwoUOMT9QJw1Lc2d33cEg7 /dt36q75UQRBiji0CXiYWR6L1sFUXgpufLNgTpLiVoWUA8bJ3/rOiz/cIMJRRvQ5 st/Pj9rKvSyyXneQ== Received: (qmail 18193 invoked from network); 5 Aug 2024 23:51:29 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:29 +0200 X-UD-Smtp-Session: l3s3148p1@e37srfYe5JpehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Sylwester Nawrocki , Mauro Carvalho Chehab , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 4/8] media: fimc-is: use 'time_left' variable with wait_event_timeout() Date: Mon, 5 Aug 2024 23:51:17 +0200 Message-ID: <20240805215123.3528-5-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 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. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang --- drivers/media/platform/samsung/exynos4-is/fimc-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-core.c b/drivers/media/platform/samsung/exynos4-is/fimc-core.c index aae74b501a42..adfc2d73d04b 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-core.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-core.c @@ -822,7 +822,7 @@ static int fimc_clk_get(struct fimc_dev *fimc) static int fimc_m2m_suspend(struct fimc_dev *fimc) { unsigned long flags; - int timeout; + long time_left; spin_lock_irqsave(&fimc->slock, flags); if (!fimc_m2m_pending(fimc)) { @@ -833,12 +833,12 @@ static int fimc_m2m_suspend(struct fimc_dev *fimc) set_bit(ST_M2M_SUSPENDING, &fimc->state); spin_unlock_irqrestore(&fimc->slock, flags); - timeout = wait_event_timeout(fimc->irq_queue, - test_bit(ST_M2M_SUSPENDED, &fimc->state), - FIMC_SHUTDOWN_TIMEOUT); + time_left = wait_event_timeout(fimc->irq_queue, + test_bit(ST_M2M_SUSPENDED, &fimc->state), + FIMC_SHUTDOWN_TIMEOUT); clear_bit(ST_M2M_SUSPENDING, &fimc->state); - return timeout == 0 ? -EAGAIN : 0; + return time_left == 0 ? -EAGAIN : 0; } static int fimc_m2m_resume(struct fimc_dev *fimc) From patchwork Mon Aug 5 21:51:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 817260 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 E529916B749 for ; Mon, 5 Aug 2024 21:51:35 +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=1722894699; cv=none; b=j3ma860wz8OvnQjti2pnnZawcNN4P/rFF6jqY8OWBaTPUgChOGeM9aR1I87UG5esHWgjCb47qAtQzgxIXiXuFfSrunc7woQ5vFcZQFpZM4F9CvlYkCyGsKwJwL7ytPVAOjGnCTQ1o2XGA2HQ16GtInhyotAC7WT9J7twN7UM6Vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894699; c=relaxed/simple; bh=x7Y+GOviXWzZ4Xq+laSowWYOs+2/GtjEnwN0+rBCfvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T724NLap3QpWzI7X1P5JFBdckq1KOI35dTcS0L8+i3MYWYBsEZNTWsBLwPflGC9hh5lhiTwSIC2FLVVA0uXxwbRi58aTSnwO46b4H4gzNAjKlir5t07G2UpYL/B9+fGnU1NKkn1s7cf1Q3+VKMECzrJ5IpuXpQfdeX5mdqJ+75Q= 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=HSd7pA21; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="HSd7pA21" 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=J0bLTIuU/Mhn2qog1wsVS/0//rPwKleWaM2YFI6mOes=; b=HSd7pA 21WJKhwN3nsHQY+m2evdIQLwd5ET7r3A6BP1WXuVV1/L/z0cvx9QPmSVZ6mDl71d P3fi58TbaBg8+VfpV07pZaubTrpmGOl/lBUsudv850u28/fTLnqmp3PhSQNORaUN gNh9C7dZhzL/8TLTPIDyK67RY5BuFvf6pYWJGOjd/2ixABzlo9gr2E0zR0GU+PUx 61kq529SB3SREb56IXd5uFCCi6tfj3JddibXjtcjemt0Ekr+I1Fbxxlu7Qzyc4L+ uSXiUuW6xezYw25NbiRD9McaCHEzuWfJF5bnQr0ncuRkP+sS2Y4bkUxhwRjPc4HT lyH0die1o2nUOU2A== Received: (qmail 18215 invoked from network); 5 Aug 2024 23:51:30 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:30 +0200 X-UD-Smtp-Session: l3s3148p1@oJr5rfYe8JpehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Mauro Carvalho Chehab , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 5/8] media: platform: exynos-gsc: use 'time_left' variable with wait_event_timeout() Date: Mon, 5 Aug 2024 23:51:18 +0200 Message-ID: <20240805215123.3528-6-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 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. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang --- drivers/media/platform/samsung/exynos-gsc/gsc-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-core.c b/drivers/media/platform/samsung/exynos-gsc/gsc-core.c index 618ae55fe396..f45f5c8612a6 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-core.c @@ -1225,7 +1225,7 @@ static void gsc_remove(struct platform_device *pdev) static int gsc_m2m_suspend(struct gsc_dev *gsc) { unsigned long flags; - int timeout; + long time_left; spin_lock_irqsave(&gsc->slock, flags); if (!gsc_m2m_pending(gsc)) { @@ -1236,12 +1236,12 @@ static int gsc_m2m_suspend(struct gsc_dev *gsc) set_bit(ST_M2M_SUSPENDING, &gsc->state); spin_unlock_irqrestore(&gsc->slock, flags); - timeout = wait_event_timeout(gsc->irq_queue, - test_bit(ST_M2M_SUSPENDED, &gsc->state), - GSC_SHUTDOWN_TIMEOUT); + time_left = wait_event_timeout(gsc->irq_queue, + test_bit(ST_M2M_SUSPENDED, &gsc->state), + GSC_SHUTDOWN_TIMEOUT); clear_bit(ST_M2M_SUSPENDING, &gsc->state); - return timeout == 0 ? -EAGAIN : 0; + return time_left == 0 ? -EAGAIN : 0; } static void gsc_m2m_resume(struct gsc_dev *gsc) From patchwork Mon Aug 5 21:51:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 816895 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 F162416F27C for ; Mon, 5 Aug 2024 21:51:39 +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=1722894701; cv=none; b=Fh6F94fpug/uL1I7aKrDPyDUzhNipQsRSl6cG+w98d9451Rz+64T4APSJoFiG8afCkdQFRswkq5y/8kOqXSrn85stB7cjZFSC6UZq7bQK430zwPngzeNNMAL8KqcxXutaY1C2HEVrPeAVY2/M1bQu5aHdL248i00ojKzsj0/WaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894701; c=relaxed/simple; bh=n3lVtU3TsJ9RgnXcF9k2JvkgGtZTXwHab5x3eepwbQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=phFXJBud6Fs1BQQQgAKgDfJtd/hFhXLpNAVjVSqWaa1QitIDQzMIP06IK8aA54l96kJEC8+iee9LYDFpaCFZQU/l1lSo24Zo3NvcxHARazd1ejLrLR4wvdpPWyGfhVmQAI+3/1U6MpqwSQig/YEM5uhAEYiFtdv0yDABKVTSYf0= 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=OJZSgzvK; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="OJZSgzvK" 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=E/3ioNezHUDYgNs61qqfnlIbtvEYJa+0YJNcsKODcPM=; b=OJZSgz vKGmNkLvQELOXXXhUimvOutMQyI6wSlDp5wE1qbovJvDTTkKGdX1TrX4bEWd0VbM EVORFF5WQuNJFZtExVd29jNSbsT3sNEg4PpPH21ioPusvQaJcwHFlfSmSREupXW5 4eEbiNFWgowg16uMt/vTKZxU/bad/TJxbyN32EW7y8sclIqq/VuKy5IdrdDRpgei +BNZiQw50V0O6hTA4oMNWpNiMFbMQea7h7neH+PvNQwr3y8NglM6C7dudsinZtcr Q3bxccwtsSkg6hVVWgZsSPEavdCZFnrMpeXiVmFuh6YiNTWwd/EUw8a4fZBHmka1 Y0MeE/gSPE3ZQXww== Received: (qmail 18235 invoked from network); 5 Aug 2024 23:51:30 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:30 +0200 X-UD-Smtp-Session: l3s3148p1@6a8FrvYe9ppehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Ismael Luceno , Bluecherry Maintainers , Andrey Utkin , Mauro Carvalho Chehab Subject: [PATCH v2 6/8] media: solo6x10: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 5 Aug 2024 23:51:19 +0200 Message-ID: <20240805215123.3528-7-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 There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang Acked-by: Ismael Luceno --- Change since v1: added tag drivers/media/pci/solo6x10/solo6x10-p2m.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/solo6x10/solo6x10-p2m.c b/drivers/media/pci/solo6x10/solo6x10-p2m.c index ca70a864a3ef..5f100e5e03d9 100644 --- a/drivers/media/pci/solo6x10/solo6x10-p2m.c +++ b/drivers/media/pci/solo6x10/solo6x10-p2m.c @@ -57,7 +57,7 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev, int desc_cnt) { struct solo_p2m_dev *p2m_dev; - unsigned int timeout; + unsigned long time_left; unsigned int config = 0; int ret = 0; unsigned int p2m_id = 0; @@ -99,12 +99,12 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev, desc[1].ctrl); } - timeout = wait_for_completion_timeout(&p2m_dev->completion, - solo_dev->p2m_jiffies); + time_left = wait_for_completion_timeout(&p2m_dev->completion, + solo_dev->p2m_jiffies); if (WARN_ON_ONCE(p2m_dev->error)) ret = -EIO; - else if (timeout == 0) { + else if (time_left == 0) { solo_dev->p2m_timeouts++; ret = -EAGAIN; } From patchwork Mon Aug 5 21:51:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 817259 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 28C5616B749 for ; Mon, 5 Aug 2024 21:51:39 +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=1722894701; cv=none; b=L9+IbRoIxK0aN1K/1gHG3lzHTnVUROJJ0QLO27g4crpRYj3YWmBS1iUrMdg3TCW3+lk+RmugnNVUtbNQfBevXZCht+mOnrMykoWAWyaa9r1PWMnTac+d+yh3IU0cagBh0SDRBVwHIXoMdckEFL9uydqINin4MNj10bmQGIa5EIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722894701; c=relaxed/simple; bh=LZYhrkyc1RQuEk08+xPPpf7DwI8WSA8aMxgUobeQYbw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hLLvrWWSX4TQ8HjDfn8gAvIeAKBZ+P8/b3+k/bfqv9TZje2kUnj43Ic4R9KGgbAv9lGlPpLlG9kVsrg4vk4H2CH8RdPjtH49DVAa+2m5FdPQfL9owq1InQwdT64xPKgBnpBt8xYJmWrXSkQTNBGjjmaBb+CKkohJEa8TjAodhpk= 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=b6vlhH2y; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="b6vlhH2y" 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=61SJjG4DfvMnVp2bdP5k8l8MGNPVIUcfz8ktix2R7dI=; b=b6vlhH 2yWlciBzJOGLlQu2ShEZRtLn6f3vxwseDLhOn7kO+KytDnRBFVrAo9UYHUVLo3PN uETy3ClfqY28uXg8u73CYeE55reruvX00bJRskE5zp485rOumrq7jW4/suiQ0VWs Uxrd0MmO+5xGM/Ql2a9NGoyJN02QSNqqjrOHyZn8D/KxglnA9iEP3r0jbjFPJ543 qJbbyJypcE0SclY9sKhvHKgnuoX24BOHgXH8RGoxX86N/goKnbfPyZ2vlTZgFat2 8b3xTN+k5GhbsiI/7EbW+wFvMssE5fYglZslJOCfi20DevO3a3Z/HsZQKCAnG/NG jNKDu3VGmMqvvQcw== Received: (qmail 18275 invoked from network); 5 Aug 2024 23:51:32 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 5 Aug 2024 23:51:32 +0200 X-UD-Smtp-Session: l3s3148p1@x8AcrvYeAptehhYC From: Wolfram Sang To: linux-media@vger.kernel.org Cc: Wolfram Sang , Thierry Reding , Dmitry Osipenko , Mauro Carvalho Chehab , Thierry Reding , Jonathan Hunter , linux-tegra@vger.kernel.org Subject: [PATCH v2 7/8] media: tegra-vde: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 5 Aug 2024 23:51:20 +0200 Message-ID: <20240805215123.3528-8-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 There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_interruptible_timeout() causing patterns like: timeout = wait_for_completion_interruptible_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 Acked-by: Thierry Reding --- Change since v1: added tag drivers/media/platform/nvidia/tegra-vde/h264.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/nvidia/tegra-vde/h264.c b/drivers/media/platform/nvidia/tegra-vde/h264.c index d8812fc06c67..0e56a4331b0d 100644 --- a/drivers/media/platform/nvidia/tegra-vde/h264.c +++ b/drivers/media/platform/nvidia/tegra-vde/h264.c @@ -623,14 +623,14 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) unsigned int read_bytes, macroblocks_nb; struct device *dev = vde->dev; dma_addr_t bsev_ptr; - long timeout; + long time_left; int ret; - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &vde->decode_completion, msecs_to_jiffies(1000)); - if (timeout < 0) { - ret = timeout; - } else if (timeout == 0) { + if (time_left < 0) { + ret = time_left; + } else if (time_left == 0) { bsev_ptr = tegra_vde_readl(vde, vde->bsev, 0x10); macroblocks_nb = tegra_vde_readl(vde, vde->sxe, 0xC8) & 0x1FFF; read_bytes = bsev_ptr ? bsev_ptr - vde->bitstream_data_addr : 0; 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: 816894 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="RdK28723" 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 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); }