Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1289262lqa; Mon, 29 Apr 2024 04:29:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVK1BFKrJvpugbjZWPGsKUzLF+puFt6/DYblXsL48uK9nwJxE8QBtImaNZjC5pP207vL/0psMqiXjzLXXBQPgXVuZeEG/HW2EtwdXZqcg== X-Google-Smtp-Source: AGHT+IHSyo/Wo9NKwhMzaqmjIgp8cSo7uv7jfPUocRwv10e79lBWjpS+XSum8gLwMFcVfQQXZ+lx X-Received: by 2002:a05:6808:238f:b0:3c6:1510:f35a with SMTP id bp15-20020a056808238f00b003c61510f35amr15399699oib.9.1714390142357; Mon, 29 Apr 2024 04:29:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390142; cv=pass; d=google.com; s=arc-20160816; b=zgv0njYW8V7YFYkj0KsBO7o2w19DX2tKuity1nRNeT428CKE9tOCIXNYbGhekl/e2G z+YieBDVJT3cHEVzqOAJQuVJIXgMUr0QY+6MVxObbsH3ziJtdTHv5AZHI5cW6fzWCdM2 2QsmXymYfVHvpKWoTCMd7n46PHP3+mbMOF1liX1A53cI5JtatQM/3IIzGff1QcxVB0ba Rpe0fJOmj13J7APOtIyLMtPwfWnpRr7KxuTATr0e5JWW+FwU9FTJIslrJsNG7YIMivX8 jvJpLS7d+R4ObrpM+ZTVg80OyS47SuFuYwqNKeTKv3z8qNTEOuGyNEmEcdMoyEDVovMK soBQ== 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=yUtX8ec+dY41NIYbceVd82J6yRSNmS1VfJIrMLj50Sk=; fh=HMmm4U7AbdvcJIoeDg7+Ktu1WvLDOfwmyLifKtq0VWM=; b=H2gPPMYdj/8Out+f7zV9hMG+PEDuawshDhwbM4kii7Da7k7urfEGIg4FVwfIttoOto 7cm8PD6ztAPuCxc+kSqjjymtDOSqlxLudlSIgkIm7Iyo44WTqay0jT9B8kqiGCtGWRqH YdNqsPUZ29UC3lFATr5GFULhGj7WNEzIOuWh0jZihmONA0TyVFXPd/Aqp6cbQGoY8fPP ZXYW+rDdBVlPC6a/IT3Rk4Z1oB5OE/MR3lyF/A63/nG1wjIAqP2Uj81rJFVjLQjnaeaN 4NocvY4MmquEWt/LF9DLkCzwze/cckS4izXN2qxH/H44UQjCoDadcwUNszMAPCnOebIS DcRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=VSWpY1uW; 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-162138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162138-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id os2-20020a05620a810200b0078edfeefea1si25782573qkn.257.2024.04.29.04.29.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:29:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=VSWpY1uW; 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-162138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162138-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 177EF1C2357E for ; Mon, 29 Apr 2024 11:29:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 443634502A; Mon, 29 Apr 2024 11:28: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="VSWpY1uW" 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 D8ED040C09 for ; Mon, 29 Apr 2024 11:28:51 +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=1714390134; cv=none; b=BCnLwbD/tuJdScDnnsVTnfV1lPoyyLBhw+QvDIDFhk7NUcSypRA+b/EwteAlU94KYIAkGRfRqP4+0RyGU0Ir4/1IXV2xSvKTEODdzB83rr18jeTLm/dxsuayGdnODEuJj78lbCE2pP02Zp3MlORaGnCYo1pMBH41vezgcB8cqK0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390134; c=relaxed/simple; bh=6lX6Ow8+WDkXB8QGR8oS5cwaB8Odx+W5VMP6TmmTnWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=giBA2hYTcCk+lkE2UET3gUaCjH2OsYlZZYC0INIFd+FOwer2QD4cKUq+Eb+NUhPSMIThH+HeUKxnyQxD0LP3IHAOqcgltpoiSxLthZwUdqlLXU9ouolMhfSWFXjJaySnnlkLDsCbEJnp4VEVSOUaYhn8qmSVcev40bcixjPjlDc= 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=VSWpY1uW; 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=yUtX8ec+dY41NIYbceVd82J6yRSNmS1VfJIrMLj50Sk=; b=VSWpY1 uW5yn24Q352EjNSnroFqqmtWFagaHZseeL4FE7mlmLJWqgarDimkWGdi/DG+41sD f67zb7fQm5FjRa2FAMVDC9859kiLObZ/F+F1a7BHiwbxs3KGSGRBlwjCzKP7DuBv OEPNe8YsRMV6l4pvCz4jZ1nvqifCNT1yScaGEtFsuaUm78WtlD3QcBGj5UAFtSAt 8RAKCy84gwtGEshdMwfIRSqNSF+3yIRcMRjt568enM8plDTpwvjzt4oiy7G9c+LI DtAlM1ymqlqz6iULtiTL7LP3jaFCirqdYlEwP40KH9iSjvNCmUvwhNvILItGBzMC fNRIkAPBMEn2QjQw== Received: (qmail 2279629 invoked from network); 29 Apr 2024 13:28:48 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:28:48 +0200 X-UD-Smtp-Session: l3s3148p1@IK2VjjoXK1dtKPB4 From: Wolfram Sang To: linux-spi@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH 4/8] spi: pic32-sqi: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 13:28:37 +0200 Message-ID: <20240429112843.67628-5-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-sqi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c index 3f1e5b27776b..0031063a7e25 100644 --- a/drivers/spi/spi-pic32-sqi.c +++ b/drivers/spi/spi-pic32-sqi.c @@ -344,7 +344,7 @@ static int pic32_sqi_one_message(struct spi_controller *host, struct spi_transfer *xfer; struct pic32_sqi *sqi; int ret = 0, mode; - unsigned long timeout; + unsigned long time_left; u32 val; sqi = spi_controller_get_devdata(host); @@ -410,8 +410,8 @@ static int pic32_sqi_one_message(struct spi_controller *host, writel(val, sqi->regs + PESQI_BD_CTRL_REG); /* wait for xfer completion */ - timeout = wait_for_completion_timeout(&sqi->xfer_done, 5 * HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&sqi->xfer_done, 5 * HZ); + if (time_left == 0) { dev_err(&sqi->host->dev, "wait timedout/interrupted\n"); ret = -ETIMEDOUT; msg->status = ret; -- 2.43.0