Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp556954lqa; Sat, 27 Apr 2024 13:38:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDPP2/r6XGPYgdBkGNxRes9lVtM07RMxSZaT5vkAme7fmOyJhgLqga8xcETzxauQ+hXCNuf8KXl1pSz1PJTSxiEDCCvf8o7S/718rBYA== X-Google-Smtp-Source: AGHT+IHHoIWo/OpOKCnTcbmAAedqC6RFY+DL+v8Fg8EMkQweq+4iHVmE/YqtyGLufHStMEy7JqEs X-Received: by 2002:a50:bb0c:0:b0:56e:7281:55eb with SMTP id y12-20020a50bb0c000000b0056e728155ebmr2868407ede.9.1714250281597; Sat, 27 Apr 2024 13:38:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250281; cv=pass; d=google.com; s=arc-20160816; b=PNztyIiaEKiXKS5QFayRzVn5KtfY2+CMLuClPHhYQ2sxnnnWRtWDh3kDw29gxSv7uc BZt/TB8zrI8+YXHUqraRAyZZL6yi+oQXAcRB/YmBduy9mK16xvpoONBJAjxQ0LNTQXqq yXwdA3710L1hT3/A7UdiFu2v56uchUAMR6/szyO91U8q7Ns+lzy5FihWYpqWGKnXo+SD baOvy8idNWxVdoHcAJexYKm8GlARXmsuU59ZjeF70j3BN/tJkycq5gnsPf7qrVW5JhjW aV/HETP9TRUxt8jBXSH19pNHl+fCUuctdO0xRgRJbx6VHrwKGwoO0Tgi+DIFDfq3efcC 0f/Q== 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=jQGvpOTQ/PjbdH5046gFtuRjUEd3lekowRVy2kqHuxw=; fh=i/+POXnWzmnIvBfvDgKTHpbXG62YuTO4ZKWl9Ez/I1Y=; b=mv0Yb0WRXNRhpilyCfU8CAPEOVi0H/A7PzbM0tWu4Vh1/IXzDv1dp2sE/uwl2xChw+ w4vensgWw/UB7JpGyLORvJ2q/dQl9AjwtJLmECepebCOC7n7YdZ/37A3UKx+BWNqMxeZ OwmZPgI0lm+2J67V+NN455Fwb00y34RxUqL0W0I2CMhFMpwP0gf2UQ0GuBh3vMKiOmEs W/xDTXS2Vh0Jg1MkfFcs81Ox3eI2VltZeMVOBSA5xoyGYrQcVn7spNd5K47cC2ra4Pj0 4IBH/K/BWFzFZC30mqiaq4d/c6OcR7ftlalwB9k9J9HTgGEXU9ijt3zpGFUbvKi6Dspa NCYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=L3+0fY2u; 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-161172-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161172-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 c88-20020a509fe1000000b0057269367116si1250519edf.303.2024.04.27.13.38.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:38:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161172-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=L3+0fY2u; 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-161172-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161172-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 565961F2194C for ; Sat, 27 Apr 2024 20:38:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 174A21586F5; Sat, 27 Apr 2024 20:36:31 +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="L3+0fY2u" 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 84421156C61 for ; Sat, 27 Apr 2024 20:36:27 +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=1714250190; cv=none; b=HtNMihSxNU1RtQ+JIyRumoBLwMjxCcIy3SBghQcJVGbOC5FtMQ1oqwxrbMBBoKf1Vmr3fEjN+4jN8qvRzfZY00iY4cZcnHcOJMkrWRFGo3W60H1eZEi7L0twgNJDI83Lk/sr2ErVORc/dIrosvFGsIpz6Zz5NmzNbUhjtFwLh9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250190; c=relaxed/simple; bh=62a58IoiDwdzg1R5YDL7NnQnvuavWO4JwBPh7wx8jzg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i6RO8pPHBHj6pxOx1964z+GdEcl7kT29kkp57+1b6607xrrSy9d/TBPUkzbLxFZdd421wZJZYF8aR5yl3WuhYkC2CDq6HO83YOZiEBacgS6bCKXMU82vI0V1QCw13O3hdzoTIkSLrc88q9cCcT9uLjzArs6J03c0MNpFE+JEEAM= 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=L3+0fY2u; 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=jQGvpOTQ/PjbdH5046gFtuRjUEd3lekowRVy2kqHuxw=; b=L3+0fY 2uYQG3EhoYZpe+4Nm3trYbjv5xdSoDowK0mlML3oaSeTLKvLofCRl2QgsHkTCVFL Xi4qIO3vXmbTFZzVktEELXmK4wgzC+DVFgxBX9spvuKpHgRPWJgImPsOTHDEImJl 589uZhyjYbpZKEQm8x3S1YPLTTyh7MDyqQxymNgX3BOFm0AZU51rcPKsNjiAIMyl UzNTvSfoyqpSNkT3qrjAO0pRjk2yJgWbuIdCj687oICRtqjYqmvQvynJi/uY5JKx Xnlw0ZjaINRgGuV0lAkUJq1pQCHSYTZooBG4pW5xZEejR6WwMPXzJPwsbNpzcRLY kihhCbhoroao6qZA== Received: (qmail 1781932 invoked from network); 27 Apr 2024 22:36:19 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:19 +0200 X-UD-Smtp-Session: l3s3148p1@NaD5+BkXws9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Vignesh R , Andi Shyti , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/15] i2c: omap: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:58 +0200 Message-ID: <20240427203611.3750-7-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-omap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 36bebef36740..30a5ea282a8b 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -660,7 +660,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop, bool polling) { struct omap_i2c_dev *omap = i2c_get_adapdata(adap); - unsigned long timeout; + unsigned long time_left; u16 w; int ret; @@ -740,18 +740,18 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, * into arbitration and we're currently unable to recover from it. */ if (!polling) { - timeout = wait_for_completion_timeout(&omap->cmd_complete, - OMAP_I2C_TIMEOUT); + time_left = wait_for_completion_timeout(&omap->cmd_complete, + OMAP_I2C_TIMEOUT); } else { do { omap_i2c_wait(omap); ret = omap_i2c_xfer_data(omap); } while (ret == -EAGAIN); - timeout = !ret; + time_left = !ret; } - if (timeout == 0) { + if (time_left == 0) { omap_i2c_reset(omap); __omap_i2c_init(omap); return -ETIMEDOUT; -- 2.43.0