Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1958138lqa; Tue, 30 Apr 2024 04:42:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuticXQ5rFEWZGfoOioI0fZAF6s7QiSh9oYdaJ0gCiXkTUN8ktbN96wDZExoGa8AhiBhLBXmYoUmfBUw89dC5uObAUICGXVpRyxIlAlA== X-Google-Smtp-Source: AGHT+IHuQn6JmXOX3mmWXGdRiEcWGuMw680mAB1MlHV9eqA3DeuAs+Gjdz586Zfa1U+9mOvsUAaV X-Received: by 2002:a17:903:22c5:b0:1eb:e40:3e07 with SMTP id y5-20020a17090322c500b001eb0e403e07mr12256773plg.62.1714477344327; Tue, 30 Apr 2024 04:42:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714477344; cv=pass; d=google.com; s=arc-20160816; b=G4jgqvplI9VA0Yzgehyg3p2AJ5VctPQFn44Zsw46uExBxA00Bo2i1AKE487VLh826T UftV7UqmJjQ2rHOCIpibFDAh8T3+eLAWzAQOkgFQC984tnPJ78kFkgObu5lT+IqDjeA5 Z9s+ZEcyLxuCmD/O7tAzE73YKXVT7uNDCg6fWfguJaxpcCWxlfCX5+abcN0wA0rNjrqW Vp4Ehn9RwtO4vpiV5cwUswpKfo3GSEPZ5FYnlf9EIgvTPPFzZXPSk5idsclSjWAZ4Zap SahwnglapRfqz625uNMf7oejv/scPapfMKLvnDozSeLrA8b1eMuVBnOZ/gV+9W1Wu/c6 0h6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MInQ7pWHBpWvz99BT9rM0W6PRLzDwOBqZlUusbB0xrA=; fh=HMmm4U7AbdvcJIoeDg7+Ktu1WvLDOfwmyLifKtq0VWM=; b=BA0oNs+HjIm8Oltb/wT1sh/Bz8YtniUSsSHPdNMUETvvlmO02dzmvPDC33s/5YVv20 kbT0V6PWjB/OTuzfi8DVMZqsJt4FgdcuSPjtcYxIEH++RggW42SV+5FTeI/dPLqrPPVM BHC4+2zrgv2SQYDyElTM8SAtLPOR+NdB5iBsjXKgfLsG0MTgtf5dufZZJ1j0Y/cUN5RO Sq7J1yC8In+lFoJyI95wYvVsExnuRA2ieQcb4nt1Q9orVOj64hOFhaazdMYJTZrKlAs3 37FiTR1PW00USiZT4eqDxQ+DVkm+QsitdSYbw3liOOFFrVedQU6i2Ywgtoixlke99FSi 63qw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=PFBQx0Lc; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-163857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163857-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i2-20020a170902eb4200b001e0ccfd7818si21425383pli.412.2024.04.30.04.42.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 04:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=PFBQx0Lc; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-163857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163857-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 88E78B20DE8 for ; Tue, 30 Apr 2024 11:42:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B34E913D529; Tue, 30 Apr 2024 11:41:55 +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="PFBQx0Lc" 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 812D613249E for ; Tue, 30 Apr 2024 11:41:52 +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=1714477314; cv=none; b=o/9VkmWfcZRt0pd1MTAeuNIv4PHbXvm/B39ymSD8kSY+ZZH8EAsIOiJK4ftOu/W5G6zZdbu9RLOvgYKDybt9IJr7vGndXqh3ufkmH1F5aydmx1vqLEH3gjT7BGq5UsC24S8Kst6dcksurTc3npv91jlKiT/B8dlhXiAVdcSb3yM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714477314; c=relaxed/simple; bh=Zmt3mvVxR8/6eumvAZBZCb07XHV0s9S1SjrKXTEDONg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MqgMARY5cnR5zTLwUBvH04KJFntYehJoVoCxgwfM0O1gzBkOa3lEiytNJxfm2EcpbOKzxznc/hLJOFnu+gAcE4N8tlvT8dPvA/Uenq35BB3mTjJv14x1l5jbafMcb93I7VRxgn3XpEHBxiodQGylYmRc9altdUfY8K771TBqah4= 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=PFBQx0Lc; 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=MInQ7pWHBpWvz99BT9rM0W6PRLzDwOBqZlUusbB0xrA=; b=PFBQx0 LcjP1lOQmgur5cxsF4MmLzW62BCayntJYN4KnDO2hx/4ZDpKZii/2uEIF9Sscfxn LbychW4mVAebCRENjb91HKlc8I3v1lzbj+e664RMGpIh7RHb/yyn5uHfi1BllnY8 JKFCp8aftvut1CRRGWDsxpTUmuBseaPoSfVXXFLoqZZQ+mGSUi1g+/6vBEU++D5o sxLMOR67vLtttJ/NnYJ5tpJqUsoVq445SdbggPqlfECvUV3w75FLmmvVxB0HMGiQ UhQrbU0OMXVgiLlqDLuEdKTe4sMVkcRzdJtNvqBy39RJugUQ6ha7TzI/reM5RYNW RnMBlBWupT4CC4fA== Received: (qmail 2617804 invoked from network); 30 Apr 2024 13:41:45 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:41:45 +0200 X-UD-Smtp-Session: l3s3148p1@2Qu+2k4Xtuhehhrb From: Wolfram Sang To: linux-spi@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] spi: fsl-lpspi: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:41:34 +0200 Message-ID: <20240430114142.28551-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430114142.28551-1-wsa+renesas@sang-engineering.com> References: <20240430114142.28551-1-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: 8bit 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/spi/spi-fsl-lpspi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 92a662d1b55c..aa5ed254be46 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -553,7 +553,7 @@ static int fsl_lpspi_dma_transfer(struct spi_controller *controller, { struct dma_async_tx_descriptor *desc_tx, *desc_rx; unsigned long transfer_timeout; - unsigned long timeout; + unsigned long time_left; struct sg_table *tx = &transfer->tx_sg, *rx = &transfer->rx_sg; int ret; @@ -594,9 +594,9 @@ static int fsl_lpspi_dma_transfer(struct spi_controller *controller, transfer->len); /* Wait eDMA to finish the data transfer.*/ - timeout = wait_for_completion_timeout(&fsl_lpspi->dma_tx_completion, - transfer_timeout); - if (!timeout) { + time_left = wait_for_completion_timeout(&fsl_lpspi->dma_tx_completion, + transfer_timeout); + if (!time_left) { dev_err(fsl_lpspi->dev, "I/O Error in DMA TX\n"); dmaengine_terminate_all(controller->dma_tx); dmaengine_terminate_all(controller->dma_rx); @@ -604,9 +604,9 @@ static int fsl_lpspi_dma_transfer(struct spi_controller *controller, return -ETIMEDOUT; } - timeout = wait_for_completion_timeout(&fsl_lpspi->dma_rx_completion, - transfer_timeout); - if (!timeout) { + time_left = wait_for_completion_timeout(&fsl_lpspi->dma_rx_completion, + transfer_timeout); + if (!time_left) { dev_err(fsl_lpspi->dev, "I/O Error in DMA RX\n"); dmaengine_terminate_all(controller->dma_tx); dmaengine_terminate_all(controller->dma_rx); -- 2.43.0