Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1958137lqa; Tue, 30 Apr 2024 04:42:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUcV7ppfD2VzX0ddBXkHtK50DdQc9YIp+CMoJzgT+bk7DJY+FpXFbCuHXjw3/9tUZDjeycfMr9AW5hjmagAE6CZR+Wr5ZdVJXHj9m6H5g== X-Google-Smtp-Source: AGHT+IGfBMjlZzPPbwxnEA82Ei8YbiVcLcEXPg3qFk3aUq2z99hJ/9sUVpOGRSQhQ+tGrraUJmkj X-Received: by 2002:a05:6402:50c9:b0:572:6ab3:39ee with SMTP id h9-20020a05640250c900b005726ab339eemr7567394edb.29.1714477344290; 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=HHtEzQ+S3fG4zKpqgmuwWh1AiwqBn9TDQkPR2vQFBYE++Mf/NGJMQ0+pCZcxEMueCo sW5yNPgdoitEwuyZ2lWKRO6/XqjEkn1OMuavxNAW+FJZhYkwEuwX87kcgWdKPHQILljS MvXPmbb0HhlawWeTfWmapR7R1J/y5lGnBudNCmLfaTpq3MoF0eoHIBRx8cMH/8A0oGOy 9OYg9VtpN6n4luAEXM2YMRL99L3G1dNz/I4e9wJcXDpEp/R6KreJWtGYUbK6MtV/P7lf Nikxx1jAd8ObMRgTzjFH8uaa5r7J3TmYB/9iz0ywcP3caruLelppd7LFpPAlrzOxJidR EXag== 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=wvkxnsMTVqUKwXCr4lgqCDnQGXpKraNd1foAJ0iog7RMAxllsWJFAWd6X5v8zM5nV2 kt6+OIxMx2m/rTzT09ZQ9vMuqOv6RAPmQNCWOBjthvSMF9oigfxprQUGAz7KPy3SVEcc 0kYgCocus4f6iyJvVvApVCHMtliWEVOW6R3DFtaC8MpE3qKn6mZ//uG3124Cgt/CKZJI OZWcty/kbBCZ5Y8h8ScMkY8QEQH7H31Am41VX/LfInaiyjYizWOOzideu/t1cLLtQLem sxC9fczOq5jyrSBZ8rqqg2PDVgd+rFRc1kh3iJbCviwsuXXv7YMFLXNbvl2aAggwrvtz 71SQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=a1Cz8AEY; 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-163856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163856-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 e11-20020a50a68b000000b00571bbab8f86si15505846edc.133.2024.04.30.04.42.24 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-163856-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=a1Cz8AEY; 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-163856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163856-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 E07411F22ED0 for ; Tue, 30 Apr 2024 11:42:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C5DE13D273; 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="a1Cz8AEY" 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 C0ED0133291 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=OjgrRlx6amp7qYhUHHrTs44yi32I+p0Gb9deH3spwQocmSpVgXO7qLXYTJ6kW7DzFt0pJj6cvDiVOpHGuMEG6rp7gAuLA5eg49A1B8ZuhejozsIB5K3gt1JTdCKfHykX19bssiAO0gtL6fMTveZJBDqsrchI4jp25+Sf77bSzTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714477314; c=relaxed/simple; bh=6lX6Ow8+WDkXB8QGR8oS5cwaB8Odx+W5VMP6TmmTnWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qlkiP29EucpTSj4sHWuSLI372uN/qmfc6T/8JZfcFXMG83CejDMHW0fsi7KY643pl/EN06xMnH7STGD7i9mbuldw7BOi8r8mNf2BWCbn+y3/1kmAD1ALlvAbWXeoP5WfAW2u9+6VNkYYMzoLhzI5mekkDVhqpABW+WtiuB0iFw0= 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=a1Cz8AEY; 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=a1Cz8A EYPrgkxSROqZth1JA3IC3tcoMIeq28Ja9BQbRljoG5aotPKjPXq9BTsMrWz08sYP fAsN7Hq0o29DXBYRshFlDIxyBxkv5m84TJv8zQbzhx1YdniH8gS/M5JIAH1UFLeF G7RM638uFcXPF8o3SRCMPYOiaGmjgCsKtoR7J6YXhZvXiJn/fqc/bgM2bzAXOAG9 f0p7QGqDsOSSPFF0KcVoB5NEX7uQwdnBwUfVT4DstrcAQ1jb85/sCuz4BnZwu3gD RDqdCSjMHBksc4qM4V/cXqumlh1ECO4W3AlRw9+mPa/wxg9x4uuOh2L0XWwz9SYo X7NcZAap1VTASr+w== Received: (qmail 2617870 invoked from network); 30 Apr 2024 13:41:47 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:41:47 +0200 X-UD-Smtp-Session: l3s3148p1@Tbzb2k4Xxuhehhrb From: Wolfram Sang To: linux-spi@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/8] spi: pic32-sqi: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:41:36 +0200 Message-ID: <20240430114142.28551-5-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-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