Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp556842lqa; Sat, 27 Apr 2024 13:37:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQbA//UT9yTcKCqJOuH7p4LUH90KSno151J41IbhslBXd2zG6FtV2QSOvJ0KGaFmA0iDtlAKFNlb1W3VMF4Ay0eu8hkpM7zOIAJttX/w== X-Google-Smtp-Source: AGHT+IEMWNMyDKAuly+PisnpGZhI/4evyVPhTuFYWlcGKw/cjWlTSDxdz3zeuLqRmCh1gu1edAJ3 X-Received: by 2002:a50:8e1b:0:b0:572:7c04:f9bd with SMTP id 27-20020a508e1b000000b005727c04f9bdmr216565edw.27.1714250251631; Sat, 27 Apr 2024 13:37:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250251; cv=pass; d=google.com; s=arc-20160816; b=htKsKfD9JvfPy1cyenOUQV/TSmANMMPOax93tTE3AjUXHrUR4QW9qdZcUhIGu1M/4I D1uT8tA96sxqeZj6ludXrSgw+lPc+QTBTrrnVYG21euyjUHL+3LigLKYobS2vCTMYV8d rXJO5LhMl7IYJ4HkhHzRXF1iTP6lk8OUJ2mzFHPQwCvvN2Je/82Knnyp+6+84K7bC53P VIFZUZklePePz03Wjzv0BFrOSLDsjv3OeiLMIk/KCt3M5P02v+7VTlOCheCq0eDZM4MQ ZXjdkq8LaoaYk7/EV9PNNdCvhYUKhaEUurwVdX0zexcfMKMPjJwbNicrIClgUrah0DLO cGlA== 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=2F3yQc5OYq/TjttbywN55Gd7XF7kO1dQ9WqJ4zJk1sI=; fh=0GcpdwOLiOrq2W2Xky5787oV6cv1rQvFQuiz83avd6o=; b=eWi3PiYRHff2Izz2g1s9H1V+SWIHiZVePheucgK/vL4vbC3jSM3iMd7bkkmrcrEeE4 vePCIL22uGkqqJ8uMgLW8GBr35LGcz7t8tCxASuHBziuPL1WQ9zK5NSSon/U+9lbesje v4dsqdaYj7GbirOHPWji7pTF40lw0BdbqUuqHTXb6JS+4lWMTwdhiF1Ax1LeaQ00ODm1 d1tfoh83ASbZazKtsIEnM1On/jET8QCd6rN2cugRlROjYilBP3zMCkXNOY+kaSqBEL32 i0nXV3hJRaBHHm2ygHfqcGZzaqLGYYOmYtMI2AbxMu+5NW4VkhmXefuCzknAODY0LHXx exxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=fJiHsU0F; 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-161171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161171-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 c20-20020a50d654000000b0056e2ad95e06si12764286edj.378.2024.04.27.13.37.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161171-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=fJiHsU0F; 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-161171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161171-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 4F9C41F2137C for ; Sat, 27 Apr 2024 20:37:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59C0215625E; Sat, 27 Apr 2024 20:36:26 +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="fJiHsU0F" 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 DF2E9147C64 for ; Sat, 27 Apr 2024 20:36:22 +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=1714250185; cv=none; b=VIoNiaHKa5mXyLgWCwxZog3DQxsdcxDnhJBq85jYYH5jNxwJzwAUQadjwoHjMIvKkZfQ1+ptiANFBTxiRxSWaV2U28xdirRyD7kLh+v8aeRtwnEgkr29p+9p3QfV6JBQomkPpZtvwFU45WR0LAvP2C90faOu1I5dx4i6eh3IbSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250185; c=relaxed/simple; bh=5bodQvN8FujH0DNsbxAsErbliMjmBltn92WZuAMz57w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FsvBQf/eZzONiP3UBmwxIZthdCRFpL/Gz2AxYgpwmz2n9YZQ7QhL5nTllINpJHdzGzoPyD3g+qLKS/gmQtGButVWXVhcFwhsyvBGx20Rsgnv95pZPICJacVKFdTFG6tG5CQkYVXGbl9CPo18GJ1tFS/3yL+KoBK4XMWKOzvac6w= 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=fJiHsU0F; 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=2F3yQc5OYq/TjttbywN55Gd7XF7kO1dQ9WqJ4zJk1sI=; b=fJiHsU 0FrDuj2rFjcEbPa/eFwf2/IKpYn2fIMHQmySsrwP8DoakwcW0k8eSgz7Sm7/2pxJ RaPpfO1YZg+tyPq84O8nUBNIUH5VQK+QNGiizJ35zDwL47RUQlonvtZsPOY/UbcA t9ug/su/9zwYFCGRPxLz4gfeH1ITq1viJBYOmVLBKaZukMTsdl93JIaHaSp/I7MV NMMOdwSA++ql2q3tNkY9t9/sfFcleDLqoBLtwmMoHuWbPqfPZzBY4zhJdAHFsrEg B0Or6avYVZKuZci2VOYxuXtqQhj2yDvu3tBDbJ2nv7/d29ElcsmQyGGDaZYi3VId TCIHT6pvTPCDxt1g== Received: (qmail 1781878 invoked from network); 27 Apr 2024 22:36:16 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:16 +0200 X-UD-Smtp-Session: l3s3148p1@bqHO+BkXwo9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/15] i2c: exynos5: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:55 +0200 Message-ID: <20240427203611.3750-4-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-exynos5.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 385ef9d9e4d4..d8baca9b610c 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -763,7 +763,7 @@ static bool exynos5_i2c_poll_irqs_timeout(struct exynos5_i2c *i2c, static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c, struct i2c_msg *msgs, int stop) { - unsigned long timeout; + unsigned long time_left; int ret; i2c->msg = msgs; @@ -775,13 +775,13 @@ static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c, exynos5_i2c_message_start(i2c, stop); if (!i2c->atomic) - timeout = wait_for_completion_timeout(&i2c->msg_complete, - EXYNOS5_I2C_TIMEOUT); - else - timeout = exynos5_i2c_poll_irqs_timeout(i2c, + time_left = wait_for_completion_timeout(&i2c->msg_complete, EXYNOS5_I2C_TIMEOUT); + else + time_left = exynos5_i2c_poll_irqs_timeout(i2c, + EXYNOS5_I2C_TIMEOUT); - if (timeout == 0) + if (time_left == 0) ret = -ETIMEDOUT; else ret = i2c->state; -- 2.43.0