Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp558161lqa; Sat, 27 Apr 2024 13:42:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmOuJ07sWCb0Z1AZgKOH1qzzNplSkTk3fYTh+kpo9a4VHnUeOMrziVWnn/IDBu9IV6EuyvIpsscIhYn+lJOUOVIaiHY3aTLDNQJbBHeg== X-Google-Smtp-Source: AGHT+IFNLVEf2Oz19pUFVNutQaf18BH2O+vbLbAgalH9VAij2Re7chc1mkfHYzoDYtb8LZA7D5g/ X-Received: by 2002:a05:6a21:2b13:b0:1ab:639c:ef65 with SMTP id ss19-20020a056a212b1300b001ab639cef65mr7971266pzb.29.1714250542695; Sat, 27 Apr 2024 13:42:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250542; cv=pass; d=google.com; s=arc-20160816; b=rKBDT/mnAfLzHTxHT9d0IMW7Vt3kGNxRNx6kF1/IM0/E17BsSNXqfx6WTQoQV2qspn thqs62Sb1aQSEzwekwcedFK/eQN7gSuCSiZYcx+07V7TcmUuzgI2CkQfN/pyo2mcsXrH 0P/KvfSpEzS5FJxdE4dMAJRDkbs27aRolpeC6tbmH6+gDPgmSXYltakyTH/DXLOTeim5 NOOWnY4CstUJFREQeaph3oR/pCEBYD2CEphNvNU3EhLZW7lg3A+qxmCQ+Qx9WpYnxw+N Dnbs9CaMnxNuMmtf/NfKeqh8ASMy7Lhy5NE0ijXv2pkcJrH4zcWCx88r1PjCg2P0+hLM BLfg== 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=cTlq5+NeurWDjBC43r6sTnS6ae5jK95Gz2jK8PwGMpI=; fh=KxEXDrzW6xhMRWSWM4FWDU3Begei+gmxiIsdXR3AylU=; b=n1tcsJM8lKoqm0TXoy00DVNflgw8ToMyq8mvG5WUoGT78aho6O20++/VUmrtFn0oDg Jwk/WiJ0+bw/RetZh8DAS5BPD80keE5NWiujpWMPZU74lfFfiqWBzPBHtlvcuymkQSei 5z6Z0s5b47pDYCOXGMpDN2XDe3S1JTdPpekipb4/T7ueGNf2rA16xfRbIwWw4qlkolcX wj0sL39pg4ByIInGnlEg/oeOsc57mQLE9wVz9BOSc+FZmKNtbMdMEvx4RF2s9MzDu4NC TygnQwp2eErpsksfjx0UeG0LbIPf1Y0ECG9tLA67WsU0fxzkeSuZkMfd064MsxwRoAAF UeTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=SQfDD+nq; 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-161179-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161179-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a12-20020a056a000c8c00b006ecf566ed70si18114003pfv.10.2024.04.27.13.42.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161179-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=SQfDD+nq; 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-161179-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161179-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8A499B21F65 for ; Sat, 27 Apr 2024 20:39:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FEBB15B972; Sat, 27 Apr 2024 20:36:38 +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="SQfDD+nq" 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 CAE9E15B111 for ; Sat, 27 Apr 2024 20:36:35 +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=1714250197; cv=none; b=RR0srVBP8+G6bNo2iQIC0M77Wyp8Nl7600J9jAFPBNadUdnGhvgmBqQR/ryDXnM9PKnNP/5wdNF6eIZoztQRC9gXV1Cq8vsjouM4iFBtnqTMq8jVN1zBvrzoyGCvVSvZCmU6JMFtnMQ+d1jE3dIgtWvB+kbTsosaQEtEBuOgwZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250197; c=relaxed/simple; bh=9xH6xQ0iM5hWBrxXUfKOBqLqw+/88LiBx0LmN8wQM+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVaJWTpomae7qsfxUfpBbG9eg6EhBF0WREyqN6netOSc6gtomII1a0az5NAUctyU5cRfBkr/Kz8+76qXHu1xkKZXJYbPWKqWQjmosXew26j+o1v3bTyJ2m9YQWzx597qs5SwOb9AjxH21oeJpkf2pawx6vZ/h0d6Cj8k8YtYoFE= 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=SQfDD+nq; 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=cTlq5+NeurWDjBC43r6sTnS6ae5jK95Gz2jK8PwGMpI=; b=SQfDD+ nqamKv0HLFYg+o9mTGxdZI99eK8DpiOQXl2bwmqlDEzxaLvDil0CuTKV/f+4K2Hr O+FfuoVmtMXuvI5cB3472PyEZmWA6rKaEN66Sr64/Cx/OKbKxTPRDqS4nPPdZVZi M1e/O2g+pHDavELKX/Ms800bRXRGkHfgZKIQMhuzox7TmE2MG8eyR3ezOTd6kLDy H4r4z+ZotMno2uiIi+cP3T0RlzY7kGWjnFkooO7+mCcx6j3ofkvGPq9ra6vTIOD+ IVCWx4AKXPZAuUzOf7zlvXp4TfC7r9MjEDtM/SpkCyknsxc+/p4W/76VzenzjwFE 0Nio/4WWwheNDxnA== Received: (qmail 1782081 invoked from network); 27 Apr 2024 22:36:24 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:24 +0200 X-UD-Smtp-Session: l3s3148p1@beZD+RkX8M9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Bjorn Andersson , Konrad Dybcio , Andi Shyti , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/15] i2c: qcom-geni: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:04 +0200 Message-ID: <20240427203611.3750-13-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. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-qcom-geni.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 090b4846ed62..0a8b95ce35f7 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -586,7 +586,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i { struct dma_slave_config config = {}; struct gpi_i2c_config peripheral = {}; - int i, ret = 0, timeout; + int i, ret = 0; + unsigned long time_left; dma_addr_t tx_addr, rx_addr; void *tx_buf = NULL, *rx_buf = NULL; const struct geni_i2c_clk_fld *itr = gi2c->clk_fld; @@ -629,8 +630,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i dma_async_issue_pending(gi2c->tx_c); - timeout = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); - if (!timeout) + time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); + if (!time_left) gi2c->err = -ETIMEDOUT; if (gi2c->err) { -- 2.43.0