From nobody Fri Feb 13 00:12:46 2026 Received: from mail.zeus03.de (www.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 9FB4C14B97C for ; Tue, 4 Jun 2024 21:29:28 +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=1717536570; cv=none; b=H2ZaaAnjASkWSKGzYqKbjkDPem9RH1xG2ynTIx8Qx7plm7m9qAIYsqcxLvHNZyOzxxRNFCDzDO68FWB2n4/hMO2AueFBooKoALm9gptH80FIeEs2piaziIKTmJHvHjlISop1h/v3flvT8npOwQmdJikLdMtG37FIxhySZ+iCor8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536570; c=relaxed/simple; bh=YjEfC9JjEnax5BqhFnJXN1aQoob3eshwGgMKZurw9bg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iK3XiFiKfnpidhOldVR9XAJrhBGVC44hPGSvL7ICON/HHG2C78AzJShyjxJZj2yVpdA639ed6QuiVMWK7gtkvdtYpBPdstQEo7Gu8p/KVoLCituZOettcqTilPmAs0aeUtLeGjns5FCtVbpTuc4egpVTkbDaM2nIAEiCp1Ld3kI= 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=Nq/kRnQj; 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="Nq/kRnQj" 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=zA/cvpSqfElfT0r6FDsRgA1YFQJ3P0br6JbLu5Xhd7c=; b=Nq/kRn Qjv5PYPTUPiv4Pvop9gisylQDuRVoPvwiFaa09ybKasLtYTUnwumWDaHPLU0nq9t 9ugMj53sIho7uvTy4XP/5EdRP5Id/GJQenSlicgpgJTnftFRR5UWl+WJlSviex9P 9GtpGnVphz8FdhlOS/8CKB8VylFXiMRQRXGp8ED979kNa5QeFK03zzM7YZITcNuI ZQ/0fj+vMfLiCsTwjRkMXuZsSScZMYkG7tQbLPqFxRgI6kr0WhecWekj/W4Ebmj3 1baHO3aRQ9RUiFJ56HfuPGg1ex+qNC1rWQCTANRG30u3uIUCfhhZJOffLthBtoml 0yh165ELd1gIY1XA== Received: (qmail 2450912 invoked from network); 4 Jun 2024 23:29:26 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 4 Jun 2024 23:29:26 +0200 X-UD-Smtp-Session: l3s3148p1@mF7sJBca9NlehhtB From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org Subject: [PATCH 1/2] mtd: nand: mxc_nand: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 4 Jun 2024 23:29:20 +0200 Message-ID: <20240604212919.5038-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604212919.5038-4-wsa+renesas@sang-engineering.com> References: <20240604212919.5038-4-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/mtd/nand/raw/mxc_nand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nan= d.c index 9d50f41b3d5a..e22fbea970d1 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -457,14 +457,14 @@ static int wait_op_done(struct mxc_nand_host *host, i= nt useirq) return 0; =20 if (useirq) { - unsigned long timeout; + unsigned long time_left; =20 reinit_completion(&host->op_completion); =20 irq_control(host, 1); =20 - timeout =3D wait_for_completion_timeout(&host->op_completion, HZ); - if (!timeout && !host->devtype_data->check_int(host)) { + time_left =3D wait_for_completion_timeout(&host->op_completion, HZ); + if (!time_left && !host->devtype_data->check_int(host)) { dev_dbg(host->dev, "timeout waiting for irq\n"); ret =3D -ETIMEDOUT; } --=20 2.43.0 From nobody Fri Feb 13 00:12:46 2026 Received: from mail.zeus03.de (www.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 921F214BF99 for ; Tue, 4 Jun 2024 21:29:29 +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=1717536571; cv=none; b=udifJYm+U83tUdghVWUGcbNDGxWPBZQS+XHGksL3vkqwqqALi3pEnk8hHji/ouF7w0GpPWLA9BqViFTISoIZTGSep2OG3OBkQ4JC3SZGZC/rrGAQvO6M2bN6UIuKmldgsFEiOZjDbBapm+hVdNlc2fftG4KYNjCB9vb28wAaqNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536571; c=relaxed/simple; bh=2DD/kGQouJsnqGRFVITaf9uQ2MSslRqtd0UUnPUDx70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GmjS8OpZTxPIRtEu5Lolw2xvKuAjMKwlpXCGk+S7mMCXTWptoMxFnGJ0dGJQI18rB6SbsK2Jcoh4TGcD1gpeSnqWUhLxl7lqJrRsJtAMQkLZv/qIQY5vy0va5D3NAr86yfG4Ex4O8zqpN585S3oEfQGazlBRGOfZbqtSwkEvdMg= 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=goYC5QZY; 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="goYC5QZY" 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=jNaCNho3HkpDyJKsOVs+JnrFnTAQRUo8cA0Au9KuneI=; b=goYC5Q ZYCkI43IZ1cDYG9/MiRnx4/qitPVvR9trSSdIkyUU9HOKNbtOHE06oYckn/gBdwL 4AaIoV2WUrWwltIDSzIR6kfyepo4XckxtcR0N5nA2CGe8C8OHH3OrkPqhXHYfxSD ceOIC5tTEInewC7QCNN650EZMgoIdAfBDPF9MByFZZzNxiLSJwq3L/ZNuBbjC0Oh BYKJEVngtBHWUmm+MGcuBdxKTmZ5j43gg/N8NOpZGlGYeOSe/eDSK45V2nBZ7c4J uVdSA5jxQPkj5GkOAmRi9I+qO9loA/7FSoeAqtX5+juIUH43s1Mh1+c8O7VgOgUk PZhCC5QWGnLY+TfA== Received: (qmail 2450944 invoked from network); 4 Jun 2024 23:29:27 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 4 Jun 2024 23:29:27 +0200 X-UD-Smtp-Session: l3s3148p1@Lcj4JBcaAtpehhtB From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org Subject: [PATCH 2/2] mtd: rawnand: intel: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 4 Jun 2024 23:29:21 +0200 Message-ID: <20240604212919.5038-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604212919.5038-4-wsa+renesas@sang-engineering.com> References: <20240604212919.5038-4-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang --- drivers/mtd/nand/raw/intel-nand-controller.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nan= d/raw/intel-nand-controller.c index f0ad2308f6d5..78174c463b36 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -295,7 +295,7 @@ static int ebu_dma_start(struct ebu_nand_controller *eb= u_host, u32 dir, unsigned long flags =3D DMA_CTRL_ACK | DMA_PREP_INTERRUPT; dma_addr_t buf_dma; int ret; - u32 timeout; + unsigned long time_left; =20 if (dir =3D=3D DMA_DEV_TO_MEM) { chan =3D ebu_host->dma_rx; @@ -335,8 +335,8 @@ static int ebu_dma_start(struct ebu_nand_controller *eb= u_host, u32 dir, dma_async_issue_pending(chan); =20 /* Wait DMA to finish the data transfer.*/ - timeout =3D wait_for_completion_timeout(dma_completion, msecs_to_jiffies(= 1000)); - if (!timeout) { + time_left =3D wait_for_completion_timeout(dma_completion, msecs_to_jiffie= s(1000)); + if (!time_left) { dev_err(ebu_host->dev, "I/O Error in DMA RX (status %d)\n", dmaengine_tx_status(chan, cookie, NULL)); dmaengine_terminate_sync(chan); --=20 2.43.0