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: 13754201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDDEDC3DA4A for ; Mon, 5 Aug 2024 21:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:To:From:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7loi66eWoM4pglv0+trIoRx+8rGoC+Ly/55TuGaEhSQ=; b=CLnsUPxxKkZSQD Lr+oBI2Av92VG7HA8aIEGPYEXql+H87OpsVzejdJVyxnUK/KymyNyAOsCHBNC8kxdkQyqjw9T2SPO 4kehsDct1oaDubGKoxcaFQZhz+nTEqtNRnrbHkbrpO8HSQJqk8m0Q5oZby9CX03kSds1veYpIjuB9 5+9x9Im7s1B3Wb5SzBdGeDQeRbctjbYeD0NyJtBANuLnH4Csjvh6/xOw6dlvg5oldKm9xLHmX8caT SneotEd1FH3KxTzM86Zpcqpj1QM1BQ4v6U92HMsCcBujQxvCRvcXuPneJgG3m5P9Er5eNq80aJ+Ke U6mUOBl+wGKWY18FQLpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb5d3-0000000HOIS-3cZL; Mon, 05 Aug 2024 21:52:33 +0000 Received: from zeus03.de ([194.117.254.33] helo=mail.zeus03.de) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb5c4-0000000HO62-0ZKj for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 21:51:34 +0000 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 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_145132_809347_DBBB4B98 X-CRM114-Status: GOOD ( 15.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Eugen Hristev , Claudiu Beznea , Wolfram Sang , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: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: 13754202 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F290C3DA4A for ; Mon, 5 Aug 2024 21:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LKaIkakCgP1OJn4iZqkkYHeziSGxZPmIwKaM52VVkTg=; b=RcJKLIeYF11xLHqhn491Jit4/B cI2Mt/UlZh3V1LgF5KxZ1Gw60VZTmMy/8uz337YUqVhKRdcxU13gv7zapELiuJFMIjrNLFClmRK3h CcRl4dakt5Hb4jQw2lTL+g6TDl3tLhUbnSL2jLSMnYeJgjiJQNRHxZfTVXJsTtHXtbc9THaKkvr10 w8XRxT6pTizSRIUq+uTTEmX3RHJ4KEv+1cn6TMwt/t0enzNiO1PtxBOlJuZB4acJF7T+J1NNsQHkc 9WfOBLy2fRY9fjA36RHorm42jCSFp8KYDMaYCZ+YkOYZ88+jExFan9K/48JFJ2jJFon66fRiZPNgM 54AlqvUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb5dY-0000000HONY-0f9E; Mon, 05 Aug 2024 21:53:04 +0000 Received: from zeus03.de ([194.117.254.33] helo=mail.zeus03.de) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb5c5-0000000HO6I-1hwb for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 21:51:35 +0000 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_145133_743891_96DA0AD1 X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 13754203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 891ECC3DA7F for ; Mon, 5 Aug 2024 21:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J0bLTIuU/Mhn2qog1wsVS/0//rPwKleWaM2YFI6mOes=; b=YHVKBV0sA3rwIfiau+jYG0cFvP OLuqfy7NfkJ9sYHtQuanTwHt/SzfBQJ8ZEfBryHM8pysWjAyr/R+h+in6kEywjd2lEw1+0LKyyczh 5b9cSPrMdBUWZfhzPLPI5z1V2hk8bHH3L+oc13R4Unzr9C51Pt0Ohu2fW159HcBt1b0+40M/yx0Fi dLqrNvVXdswsPEdgkovRsko7oT9xG1+5Xc5Nwt5oBfjJy34Az79Rod7CTf+Q54SflTw1fl+2EcrWb 7vzocjlAEuO0p9wYv/JRUSRsdXyAI/cvTx1ePumbrqWUxvJEzQ8AsC7MnPmKfqpDlBsFGfAHM3VaR 6FTAAqVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb5e1-0000000HOTm-39nl; Mon, 05 Aug 2024 21:53:33 +0000 Received: from zeus03.de ([194.117.254.33] helo=mail.zeus03.de) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb5c9-0000000HO7J-2DbA for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 21:51:39 +0000 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_145137_863801_2670409A X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)