Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp557132lqa; Sat, 27 Apr 2024 13:38:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWFyg+jHrEkXTsyK9xwXPK19wXE4+HsKPUq4m3khjCnsGldEgbqOLLbOtP+qVdnkrUj3dCxbGPjbyDCsuKfldLHRAMjlhd/tSn4FYskUw== X-Google-Smtp-Source: AGHT+IGQdXcpTGOWYknw/x3PiKSWjoOyU+uLRXItuaBwAD8MHcnqiDnmIItmRiyKzYAzV/kytjpm X-Received: by 2002:a05:6402:6cf:b0:572:6b02:b89b with SMTP id n15-20020a05640206cf00b005726b02b89bmr2140398edy.16.1714250319248; Sat, 27 Apr 2024 13:38:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250319; cv=pass; d=google.com; s=arc-20160816; b=XcOttx4dDq4IpBVDq1N/lXR92p3sp+kDlv6xe1ZhW5vQqvqCfDhJtV+OKihUZqJM5j RPvNbS9WuCJ6ss3z3boITL8PwIAeIwPIp3wLA0+swOmcpUoOitTFIx7a5NStV8wFohNA 1dKlp4GUeqfN/ZiwxXLPli0CdD/FYrUoYJwAbVKO30CLzWmqVegWEwCWaafo2twsJTqc Kj9M40Agn0iNANFXZPMDxXDQliL+60NHvTXBWmkLUBrzqIQJEz7004wguju8OmdtE1Cq 6WbAk/msHdNaN1mFHTTyiVoisTGFJvjrJPTdUSQ/OeidSS8NBhabcK4NMTWownH5LxGF Dj6w== 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=YtBKETUeeWdigupUNh1poF2adUaIr8Z2d3RrJ3sCaV0=; fh=UJgGsIj3v4K60Vrb/sALMQCdg3OHmTyVYoVoeABJ81s=; b=PjLtKUC7fzySV7iOGgRQROhP4Z18KxKPVMu72ZbaCPy4YtY4NXjnXKAjSS/nUehI4j h8ol3a2wrYHq/Kb05KESvi1/hbpqsJDvbIXti7RWi9pHuZW6DG3FZxnKlkEpNzKVvAPe 9der+lylIWEprYEBZSzAiZXXN5ot31be97wxiJUAyiKp76DWe7B4R08GfdgLwVOQSlDX MUklHFDjf8OY5YXuaLyabYm5dHsUEHvrph67pyNaJvBNAEfhVrIR+Nz/VtCWiUU4K8qA WsZK9M2YA237FBQAOYjHzFEWAfqB2ticHioGTDtzNuzzypK1sguqFV+jaggtat06D4CJ 3G8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=gOYqFv1h; 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-161175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161175-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 r7-20020aa7cfc7000000b0056e0988e60csi12069336edy.386.2024.04.27.13.38.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:38:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161175-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=gOYqFv1h; 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-161175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161175-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 F2E771F211D9 for ; Sat, 27 Apr 2024 20:38:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4343D15AADA; Sat, 27 Apr 2024 20:36:34 +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="gOYqFv1h" 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 BCD6A15887A for ; Sat, 27 Apr 2024 20:36:31 +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=1714250193; cv=none; b=h1fh5qtzzkZc7JRiFDEEBcleJxiUWM76VCE7nnSLLwpRV4695vqLfy8b13KRBEW67K7HZxJr1rG3xydvrwjgEX91d8jHk3U9vWjCO16ebLLMmm4mkOIun6oXyYHdYdiWBPw5nwGigj0atcBFhI8dx61np+RWVpzp/w7TBsYm4Zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250193; c=relaxed/simple; bh=zMu+yNewBqoDipSU74HvvlkDLWwOVjxUjGnxsnMRywE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S5riy1M7h4422YCXGYsoZASN5g2SuUhFId1mXECEEhWabzpVLqBP+pcPY/Hvl4VSxWoQWC+5BluFbiWJoGkTtucX4pU7b/ZbfAP+2pnaRr5v9IAP/1tXJCxZcgte/VxYXGMdBvL/3t5ddw1JhkdaTHfdOd1EtY52AP2cXtDemyw= 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=gOYqFv1h; 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=YtBKETUeeWdigupUNh1poF2adUaIr8Z2d3RrJ3sCaV0=; b=gOYqFv 1h+vS8r2Jh7ErStywwggdVCLpThEUHqOT3Pr9Yl8/Bj3LNrIuZKYrWRJs6jd8fpL YWuTmxexa05QoXMra0ELDpsHesZVfBelM2P6CO2Yyg5Ok+eucKHhso1HJf0dKvlN hHyfEibxw7g1vs8jvFH2DyDozOdipgzZ/mt1pALZr5DR0LVz9eS9upzO6KDsmBMa t5qA9bQKCtNvax/YPaPkA5dUsRVckAMvHZTt1uXtldzNryidwLL7hImJnsTIN2Rq 360HMvNXGh0c2uDI22nZaXEW0Mb3okLZhDgA7JIt94wq4J4IdVD7+CoccN57tKA/ hWzfRSZ1Y4sk1qtw== Received: (qmail 1782013 invoked from network); 27 Apr 2024 22:36:21 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:21 +0200 X-UD-Smtp-Session: l3s3148p1@8rwe+RkX2s9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Pierre-Yves MORDRET , Alain Volmat , Andi Shyti , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/15] i2c: stm32f7: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:01 +0200 Message-ID: <20240427203611.3750-10-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-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/i2c/busses/i2c-stm32f7.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index 01210452216b..cfee2d9c09de 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -1789,7 +1789,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; struct stm32_i2c_dma *dma = i2c_dev->dma; struct device *dev = i2c_dev->dev; - unsigned long timeout; + unsigned long time_left; int i, ret; f7_msg->addr = addr; @@ -1809,8 +1809,8 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, if (ret) goto pm_free; - timeout = wait_for_completion_timeout(&i2c_dev->complete, - i2c_dev->adap.timeout); + time_left = wait_for_completion_timeout(&i2c_dev->complete, + i2c_dev->adap.timeout); ret = f7_msg->result; if (ret) { if (i2c_dev->use_dma) @@ -1826,7 +1826,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, goto pm_free; } - if (!timeout) { + if (!time_left) { dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr); if (i2c_dev->use_dma) dmaengine_terminate_sync(dma->chan_using); -- 2.43.0