From patchwork Mon Jul 29 10:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13744704 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 941B5C3DA4A for ; Mon, 29 Jul 2024 10:44:52 +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=mNG1QcRukPbrV7A1uveNagm98lJhJ5wFJcz8A26m1zk=; b=cJTQlyQwOymtscls47RRbxN7zv XSOZa/Q7FQdhuew/I1YucJ5lFD42ICN2RtuHX+rE+yx9BKWfdYg/eH6zWJmgg1W/z1xlyJtBFZGKt +pDmt40u/Y2/B46kSzx/+r9lCZPAT3EIsC07gzsEgSPDXEgcCHNP7tJ6f8rKdpJKJQEB/rF4WYX9S PL97w+rLxTwMXSYQ3Y8YleO5RZaYheb8C5wQemT19SRJAj1bmMm6Ie3oWRJ6bgK9NdinfWeDRZkCZ mQGGhPvhb4srNxr9KfXkO97U4n7LV5xpBiyvl41MJBCzp2pg8GFUhrVgMUUNVbZHNpRVT4mqYP4kV Xb6tbb2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYNrn-0000000AwTe-12jq; Mon, 29 Jul 2024 10:44:35 +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 1sYNqq-0000000AwOY-3sfx for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2024 10:44:10 +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=mNG1QcRukPbrV7A1uveNagm98lJhJ5wFJcz8A26m1zk=; b=JAPkoO Z+n2Ses9yaiTs6RuJ/aoTn2lpClzYrxffn8QaCwQ52pa76XVEeR559nk2rhsTEVJ CcNHxoBt9OhuiwD7jBXZrOUyXh2WQ+uvW6bFs+FG+DyxxKCvirPe3b4mJgesKNyI YmRw0dmbsfRyJ1jzdLz8VwtblHZXLdeAj51XPB8+8FmEDlfznkA3uP24+X3QD/+w 9RRn9pZS0PMOxtghSxCFhm1op+oWBZpqN5A0DMV8avrxtBHPpZgQYC/q2ZU7ynnL IjcNYnaLRAv7uMJe8AYGwVtS4a3TGr8RyI0qTL4D0ArXVWsv4YD5tKpGXCyDbor8 +Sct3XXY7UTvUGOw== Received: (qmail 4072162 invoked from network); 29 Jul 2024 12:43:25 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Jul 2024 12:43:25 +0200 X-UD-Smtp-Session: l3s3148p1@w0/dh2Ae1uEgAwDPXxLGAIH3oZkcU6AS From: Wolfram Sang To: linux-fpga@vger.kernel.org Cc: Wolfram Sang , Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Michal Simek , linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/2] fpga: zynq-fpga: Rename 'timeout' variable as 'time_left' Date: Mon, 29 Jul 2024 12:42:23 +0200 Message-ID: <20240729104319.2658-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240729104319.2658-1-wsa+renesas@sang-engineering.com> References: <20240729104319.2658-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-20240729_034337_964962_1BE9C70B X-CRM114-Status: GOOD ( 11.46 ) 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_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 Acked-by: Michal Simek --- Change since v2: reworded shortlog drivers/fpga/zynq-fpga.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 0ac93183d201..4db3d80e10b0 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -387,7 +387,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) const char *why; int err; u32 intr_status; - unsigned long timeout; + unsigned long time_left; unsigned long flags; struct scatterlist *sg; int i; @@ -427,8 +427,8 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) zynq_step_dma(priv); spin_unlock_irqrestore(&priv->dma_lock, flags); - timeout = wait_for_completion_timeout(&priv->dma_done, - msecs_to_jiffies(DMA_TIMEOUT_MS)); + time_left = wait_for_completion_timeout(&priv->dma_done, + msecs_to_jiffies(DMA_TIMEOUT_MS)); spin_lock_irqsave(&priv->dma_lock, flags); zynq_fpga_set_irq(priv, 0); @@ -452,7 +452,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) if (priv->cur_sg || !((intr_status & IXR_D_P_DONE_MASK) == IXR_D_P_DONE_MASK)) { - if (timeout == 0) + if (time_left == 0) why = "DMA timed out"; else why = "DMA did not complete";