Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp556820lqa; Sat, 27 Apr 2024 13:37:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtHEOao8okI1lbjArd5d3v0DbbI8MBjykJG/SohYPabtRL3acm35zCBWScC1DwjyBjSr+xXhwVzjiC8PfFj7zpKx9sG56I7Lkc6Chu6A== X-Google-Smtp-Source: AGHT+IH7efHfJOAcvqZxM8oM7FavTL4IJW1DPKYxCwxp4gj4eHbyoN+8vbRKd887+FsAYfqc4yuB X-Received: by 2002:a50:a419:0:b0:570:c8f:1a35 with SMTP id u25-20020a50a419000000b005700c8f1a35mr3960595edb.8.1714250245482; Sat, 27 Apr 2024 13:37:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250245; cv=pass; d=google.com; s=arc-20160816; b=TV5JcWbclcBmZ/in9Z1YMNkiYCth/qtXKICE4SKtPIMsC3c4mSdo3qISOxDPoLZ/n9 f/31hoA8uALAxHS/2FyOpXJAEttBaU0Pqf19dNZn8uup+x8iPoC60/qlETO1t7T4t9IL dCOqsCnNp6VhHaA8nueR/TvaQ6oQwaiqvY4OYZ/ltsnWq4Y6dV7YRXnXo7Hz9atNcfMC PRvjUPNGrMTNcyc2xK4ynvgNBAMntbO3DHW0FMz4ilvjxNDBnn1yK2qt8akwxkbbBOU6 knWAVkexjLZUAIh+hyny1uWQBsBkzvTSMgH89p+uRtZXdeOq7Ceyai9S3ZnRuyT8TzA+ uk3A== 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=oEViMnEeQh7c6qFI7c71gpMDemDVCP/zHpYArgFPMWA=; fh=Mfd9c3MYd6Q+Powq9wv6XiPcgk0zZW7+7SThwo/rzbA=; b=Ec2uQEBcvQshw5sLlfWEvX9YI6OQh6TZ4LTcfanS5K0GCeF2J1a/BXQp2IG2DC4n79 WHixxkIAUsSwvop3hIyU4LCYt9ajyfJ0+EHfexbG98zHlClWU/WOb5hFCKnieSWG5FwA hmpJRPZGD4Uk4kY4maopsIUw1Tkq9822K68wOCpyUAngWnbaRJSYxdIZpUmNXRu+Gn32 DWL+zmKrf0+CWUg1Pim11Mh/H0qFQcyGi49ixFCUBAleZN3d/LlS/8ZXQE+qJRf2zTJe SCfsziKNs0roHaJVqm7rJG+VFjJaKkJQ0TMz8b/cdJRe7ZwF8Vn7CxBLgjQ2YBBxVK8P 3D8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=HZjJONq+; 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-161170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161170-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 l11-20020a50d6cb000000b005727c9a18a6si67727edj.127.2024.04.27.13.37.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161170-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=HZjJONq+; 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-161170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161170-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 384E91F21605 for ; Sat, 27 Apr 2024 20:37:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C08AF152520; Sat, 27 Apr 2024 20:36:25 +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="HZjJONq+" 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 EF43B148313 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=G1F/CBQdet/PXyZvLjTDJC0nfWaesrxDCWvCTjk/uDj8nhBe3IuL205KzPQ4HUIBVyNNdh7QJf4vILwl7prfX3rFk47LXUK7uqQpbTpsPlFQIlSgnYuikXrlJFvEAGky7ST0bw9bG+UX1Aoek6l1l1Xs4FPP2dk4lV5ZfR2Bemk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250185; c=relaxed/simple; bh=GA20x9tiztOUcMRH1FpY/DCyyt7eX+luNbboYOEjcPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sC0YSA0GZHPLiQUgE+Ku80ikA+9Uq2QXtTFShZ0t8/1SNwqgdGAz9SuPp1c9jgMkexmAsXbnMFk5u8fuHgWVhPU/0thu4kFxR+0gxA0CLjaZ5K2dx1JTpygvSoADI+05ID5JV8xGF3VWB89RNin0K5iwKzUcbhF/d37LsniqpWg= 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=HZjJONq+; 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=oEViMnEeQh7c6qFI7c71gpMDemDVCP/zHpYArgFPMWA=; b=HZjJON q+9hbgCHYqRSse7kQ9X730Juffrh4t3/5Cy9U7md22+oeBwczkNnmU0iXPnGi089 Xvl/3dfTTfO5krroDEZ30Sqspp0FKDgd/x8R5hw7STXYXYcqtOGQeNiaHAr0rCuO jvxGZrCOS+upr2JzYnRQXhPYqpviGBhTaTJ5nGgksefRayCJgnR+Ib2GHybbIdCq gVLBt73Zp92rrBjPBH3EH3frfXeGUMsdetHun3/0lKsYbbPcNP77wIw794zdiV8g 24tNX1GrN+Z3CSS15TMILkmOHUOEhVYrU93d4BYJ+fUm13uOCQK+ldT2e0HEijTv KyD6zK3GuHdUMO3w== Received: (qmail 1781896 invoked from network); 27 Apr 2024 22:36:17 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:17 +0200 X-UD-Smtp-Session: l3s3148p1@l6Lf+BkXps9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , linux-kernel@vger.kernel.org Subject: [PATCH 04/15] i2c: hix5hd2: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:56 +0200 Message-ID: <20240427203611.3750-5-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-hix5hd2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c index 8e75515c3ca4..a47b9939fa2c 100644 --- a/drivers/i2c/busses/i2c-hix5hd2.c +++ b/drivers/i2c/busses/i2c-hix5hd2.c @@ -314,7 +314,7 @@ static void hix5hd2_i2c_message_start(struct hix5hd2_i2c_priv *priv, int stop) static int hix5hd2_i2c_xfer_msg(struct hix5hd2_i2c_priv *priv, struct i2c_msg *msgs, int stop) { - unsigned long timeout; + unsigned long time_left; int ret; priv->msg = msgs; @@ -327,9 +327,9 @@ static int hix5hd2_i2c_xfer_msg(struct hix5hd2_i2c_priv *priv, reinit_completion(&priv->msg_complete); hix5hd2_i2c_message_start(priv, stop); - timeout = wait_for_completion_timeout(&priv->msg_complete, - priv->adap.timeout); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&priv->msg_complete, + priv->adap.timeout); + if (time_left == 0) { priv->state = HIX5I2C_STAT_RW_ERR; priv->err = -ETIMEDOUT; dev_warn(priv->dev, "%s timeout=%d\n", -- 2.43.0