Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp557461lqa; Sat, 27 Apr 2024 13:40:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWg8dH+nzwN9N61qKMGiOuDqjczuAuCTjuwkqJ0vMuAshWviQKFHtBz17NQLyFbSOywicaz3UjK8NN6px1KpwN1r6NcKkzPCNkK1i2DGw== X-Google-Smtp-Source: AGHT+IE4cFlBGkwDASk/U56RU8QVhPwiHHIjDlffoiFy79Ra9R+dvAvi7e/pIGhhfPodW+SQALsM X-Received: by 2002:a05:6870:4589:b0:239:18d8:1519 with SMTP id y9-20020a056870458900b0023918d81519mr7074562oao.46.1714250400923; Sat, 27 Apr 2024 13:40:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250400; cv=pass; d=google.com; s=arc-20160816; b=HXowWFTHRl1FgXd+xJ7JPwXXY5WcTZaAcOArN9STs3eicU0UDxdnGqyWZkwjk96NYg 2Crc68kOTG5VYq9xeEeEOKgtwXgHrLwxDRwiELpfGl+054J8SGKmPZFgMVSCxiyUwOE7 RmfaFUOO2yHDsqRpYUxpSXQsb4b+FE3SHRnC16IY4k/fYk3bPJ0TkILeGelSRnaIHR0o Zy0bMd8YYUpRVJQX+mzrC+AGYNw93orujdYv8Mbh5Oa6gvLSOuvwqKai5bCTXDkAVM0O s2yFbLUoOFU68V/LGBDL14isjk9dp6uEGul806oCUxhZPK2Z49rPDnB8WLM1UygsYjG6 KbMg== 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=lgb5SzZOxsbM5nweq0hf5zFbKk9/34W+E/fPoNu8BgM=; fh=aIWr/Wm4eHu3X2mqZr11Avc+Henc63lXYfTT6X2PdEA=; b=oZVyb8lfnLcfTSu7UmPo6xotZmSfmSob6ZluVD+uttkWIeSjKiajiWuYLQoA+Vdu2S ZVo3xdn7RHD293JvXDg3QNOrZmk/SAvSJGtS1Bu78X8TJrbH87rVTXSPRJrzQw9ZtJVf 4LOu99tKDdGMkR2veBRqSbf6NfkzOa646hA9sHhFxYftH298d1DH1+NouF4gfOgOqzGg KdfMj5yTiGu2zhpTkuQapQjnn54LFKEX05URGVIVT1+oMhjQQbzJKUuQf916pUuFqO+G pCYLQ19xbMyfAOhyvFf8kLaveDsTBh9foIZ+8/EAGmDBer2Rw/0HOj4HwGL94eYE+buy DTgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=FNRdal9N; 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-161174-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161174-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 u193-20020a6379ca000000b005d8e3c86163si17769793pgc.142.2024.04.27.13.40.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161174-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=FNRdal9N; 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-161174-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161174-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 A11C4B219E8 for ; Sat, 27 Apr 2024 20:38:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6C7B15A4B8; Sat, 27 Apr 2024 20:36:32 +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="FNRdal9N" 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 2961A15534D for ; Sat, 27 Apr 2024 20:36:25 +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=1714250192; cv=none; b=gtuO62FqYt+JQj1JSRpX2SxDEDZx6kFEeLp9V4mYy13TkGcHwzvgZgaQ1DCzO+ccCgAzhvnQ6vzTsiuNEsnGzAZFVPXcBZMiC5hZF6k+00sZizd8Rwrz/lYnI/BUlx76CwlWLzcPH0DeOIqIGdIeGtiJDh+BGvOlggjTnBmfFes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250192; c=relaxed/simple; bh=n4hQc5gZqdrk//Rxy2JOXADtiKMOzaMTzzXO1IINnr0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TjQYk2fu+VlWjXInnhzBsaBjbWzRW3tQXfWOqj/I23a4SXZ65c+j2kReR0Th8Bn9S/cqqMXY+bchIebkCKukhv+VdK8x5Jv/asfA0TMp+zrOtoybCy7IfrdN++linBPPwaDilTkaD6nwpTRW136tPVjtgTw8EO9E8GnwZS18XY0= 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=FNRdal9N; 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=lgb5SzZOxsbM5nweq0hf5zFbKk9/34W+E/fPoNu8BgM=; b=FNRdal 9NQ6vzfXBzcTkf+PgQZ1TcO7TXIwlE2qCZcth2/uSaa76PiE6woabAXEq4BcjnQT Ob67SFbg8SmjEONMw50ZZ7Xt+rp4mGVb085+TH7Z3l16ZMe7zWwfmzB+u+64DUtH kAM/2qBP0dK3Ux1E3tPslg+feGkWQetQSDPPwfeZIhZFCbDrstt9amQ+GWS5SdXt e4/rDMN5l3HT5jqJlstfd935xijmv+n9839AYqyD8fOF5UjFNJZChsXrTYyO+lAW buIei5S4w89RfPWb/6BX6n4TOGf1EyhKjGzwllDrAnIk6Zj0vWCdiA97hjNdVcSl 3GBUnGbQ5NLGJOvg== Received: (qmail 1781911 invoked from network); 27 Apr 2024 22:36:18 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:18 +0200 X-UD-Smtp-Session: l3s3148p1@Rr/s+BkXts9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Dong Aisheng , Andi Shyti , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/15] i2c: imx-lpi2c: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:57 +0200 Message-ID: <20240427203611.3750-6-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-imx-lpi2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 36e8f6196a87..0197786892a2 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -307,11 +307,11 @@ static int lpi2c_imx_master_disable(struct lpi2c_imx_struct *lpi2c_imx) static int lpi2c_imx_msg_complete(struct lpi2c_imx_struct *lpi2c_imx) { - unsigned long timeout; + unsigned long time_left; - timeout = wait_for_completion_timeout(&lpi2c_imx->complete, HZ); + time_left = wait_for_completion_timeout(&lpi2c_imx->complete, HZ); - return timeout ? 0 : -ETIMEDOUT; + return time_left ? 0 : -ETIMEDOUT; } static int lpi2c_imx_txfifo_empty(struct lpi2c_imx_struct *lpi2c_imx) -- 2.43.0