Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1289667lqa; Mon, 29 Apr 2024 04:29:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjr0LDGD2eQzax85/P51xQkq/AZb4H1R0VrGZRdWfC0DNFBDgkKfg6nNG+qZhVCnuMLj1wTSTejBIkGAIfQs0OmomDJp3iZra7yMjUMQ== X-Google-Smtp-Source: AGHT+IHupLXk71IXCFgazu57L7iE4JYxkMfPJDDBgfFd9exriBVCw9VwiqK0ALrUWbVXQeh/qFbF X-Received: by 2002:a05:6512:3c87:b0:51d:9c42:ca9f with SMTP id h7-20020a0565123c8700b0051d9c42ca9fmr2838605lfv.9.1714390194009; Mon, 29 Apr 2024 04:29:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390193; cv=pass; d=google.com; s=arc-20160816; b=cWUtzD7tdu4zg+m/zsQUBJAMzRSnpAqKhVcZxpcufxWs4L0xFpp/8adghWYKfXw0R1 3oCK6xRrcX00ctfBAiuyet+akWME36k8jmXZD577wSOkKYvmzF8YFnvg08CyNPwjBw7q wcPkdElZ0FYcPJC325s1nHLzMVMBm+QAO5dLWKtJG8C5MiQNuCvHGGlW3LHStmLpYxuA Gvnem7qZ/oRycXf8kwMxUsyeRX5bYAntrhBgENjWdadLcLIoHj7NbywtngYuUyFkhAKF JWW1jjEN5QhlRpPbbmnl7eolCiwgR6V3N4nDCbXpACzwdRPK10rZ+DDGw+EIOwwhcVww RXlA== 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=wiD2un7//igTyi+4riuvfy4dW9R7R9MwCjnV7qyUbeI=; fh=HMmm4U7AbdvcJIoeDg7+Ktu1WvLDOfwmyLifKtq0VWM=; b=fAigcgREXNXO/WD8yAmjZblUrP2dH/BTEnAl/GNIi9fRdqdE14f9i95b7/Z9P/Z5Qn iW8awY/0P0booI7eyotTgBna/xFAHqnhqiKFpxqmR6xQYTc+dmHQI+prDPc8HAdWH9pT rhhJF15EiSkGzKQ05/ZKea4NitMOzZk4DSbF0WvT6eATJv3j3BD/+6edwp7TduZc+IQa hCsyEvfd0zPMVBNn1zPWj66MaIQlR12nM1aImpI8uRFhBs3AlyAp24eKw5craoT6ZT2s nc4eba2juoYp73sr6f41a86yxdbzuhzrxfAHsDJAIPY008cUkISznmiVgdubO4XTuyth FQSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=Cm8xoqhr; 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-162143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162143-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 22-20020a508e56000000b0057278dfc375si2182938edx.329.2024.04.29.04.29.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:29:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=Cm8xoqhr; 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-162143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162143-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B5CA71F235BE for ; Mon, 29 Apr 2024 11:29:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE79247A5C; Mon, 29 Apr 2024 11:28:57 +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="Cm8xoqhr" 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 571C04594A for ; Mon, 29 Apr 2024 11:28:54 +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=1714390137; cv=none; b=iobjNKtAekNwEAD5gx5apos4hoUjik5PiMFHauTmArVDnveT9lSz7MuLoxSMYYlBSv7tKWze79eYzTCUAfNua+7xV3pwdbC94VAjARF/yZUzYq9ACDJL5uDxV/KjzvV4lyntu5DfaRbgDcnd+X3BPuqhtMWYAYSqJnx+Fsn9WwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390137; c=relaxed/simple; bh=ZZCt1Knc3LTkd7ud87jJX+jMQvb71Ot0fnQdxWqqxKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sGPj187OYaTVTFdCE5vf4/QBb/O675fcggbFDW5JjERECOjaJaJCIEMels9Tsk1UarJcGMi6om7RoOGag2BJ8cjKwJ+5lp3jPJIdLLvAUTQic5o5Mf9ICuN1A21FszQWM1LOaJ20CtBCWwfqbxXZ+ilFq8SzfW6imBUWlLMs43A= 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=Cm8xoqhr; 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=wiD2un7//igTyi+4riuvfy4dW9R7R9MwCjnV7qyUbeI=; b=Cm8xoq hriBqVte2y8G0rg6Ug/N85sy0zOjE4Pb94WiwqEMXBNXLY/QtC8ZBzikKXpsoguB ods8iB4Jh6r9tVbUj5YvjX8JMM0N67DeSsCEehhY4B1MxBGIyCboae8nTg2hF+Qi pMHp2ckB+R3ojPnLsRq9ZlgeG5GVqYWw1KMGBKV+4i1iob1sPvKGX59JCOUzJvG2 xJ/stN+qddmEn7uNVWSV8L7qd7Rvxso22iPMJHit69WC05A79L8GfXKRdBgb7T6E YFXFZqUfeVDqtl4HADwv/gl4UitT5BpdwuUdTUczqjGok/pKKxQzBNzVd97Ulj5U s6ejYtEXGAQX88yw== Received: (qmail 2279659 invoked from network); 29 Apr 2024 13:28:49 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:28:49 +0200 X-UD-Smtp-Session: l3s3148p1@pOukjjoXlx9tKPB4 From: Wolfram Sang To: linux-spi@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH 5/8] spi: pic32: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 13:28:38 +0200 Message-ID: <20240429112843.67628-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429112843.67628-1-wsa+renesas@sang-engineering.com> References: <20240429112843.67628-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-pic32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c index 709edb70ad7d..b8bcc220e96d 100644 --- a/drivers/spi/spi-pic32.c +++ b/drivers/spi/spi-pic32.c @@ -498,7 +498,7 @@ static int pic32_spi_one_transfer(struct spi_controller *host, { struct pic32_spi *pic32s; bool dma_issued = false; - unsigned long timeout; + unsigned long time_left; int ret; pic32s = spi_controller_get_devdata(host); @@ -545,8 +545,8 @@ static int pic32_spi_one_transfer(struct spi_controller *host, } /* wait for completion */ - timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); + if (time_left == 0) { dev_err(&spi->dev, "wait error/timedout\n"); if (dma_issued) { dmaengine_terminate_all(host->dma_rx); -- 2.43.0