Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp557196lqa; Sat, 27 Apr 2024 13:38:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVpEXA4yCQmJO7fj7k7av0a73PUxIjyjK8z/z+A6F+b35aPEq3BntGlcPG6WNVgS8/bGyRhgrXBofvWKdSh7gZdAlW0FsQeY/VToJkGQA== X-Google-Smtp-Source: AGHT+IFim1kO2hf5tMOKJTVV7Dj+sVz8yjx+ld9E9jK+d9PdORnw6WSS0fKk3E+qdwDkumpoaGTI X-Received: by 2002:a50:f692:0:b0:56e:edc:9837 with SMTP id d18-20020a50f692000000b0056e0edc9837mr5736870edn.35.1714250333802; Sat, 27 Apr 2024 13:38:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250333; cv=pass; d=google.com; s=arc-20160816; b=vOWRkp4xJXW834q6LGiztPALrb2YQiaJfkFs9vOyHpLM41N/mY+WPY3N+lIBvcOQmT b5XU7A5TwzOueLifWM4ZP+StUCiJJIU3cNUStAyBPlWl1vsRT8GDfKOTPzBjooJLIGsR AfdFGr+KuMwGG/MNT44Qw2qsRXOyo/OMA7R6+zd+bnrq0rmlS1kI2tQae1uGPhlcq5YM eg6PfNerrJCd74Fgu/+nMFOAUIl8KcFgMW99pwJLVhGXOPB9IMEmKeQBjkC/wZQ0kgbU ryGHOwFjEzRW1G+10Sp99aNCYiJNpTA5OKP0apAkMXpEDVmUXJh9s/Du72G5e+NktnWu YfqA== 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=gZ01Lhe4pAwdcuNCxaIYgv6RGXpiS5mlcEHdQcrIkWs=; fh=UJgGsIj3v4K60Vrb/sALMQCdg3OHmTyVYoVoeABJ81s=; b=A38B3nw0GcxoFOKA2WHUm/ooK1SLSvsan5qbHm4XBxfzQUuJrGkYfjo+yP0faIqfOR PbB7NKAGWOEGNbPkggpmerpVdXGA/AwByCpIA5qSyI/3guQDC+uIInhwt86OO2dA6fGY E2I5HiiW7vZmIXy5kyeIifBOl80B2dVKwhyubMEw5zkmTvRDMZYU4JbE+Wy9KNjOTfRY /GM10219s5WKp7Jydcw2FonWgXBK86Nka9gBLjz0/UUIbSZ2p3WB9O/KyIxu7nf6dzNi VGwag8LhLzTq/s4Yud+URD1EUCejq4LrnY4FESrPbdHImuJYYGQBnWtxiFim3G0bVasp QNTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=HseIkXQe; 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-161176-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161176-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 j12-20020a508a8c000000b005727013b76asi828829edj.74.2024.04.27.13.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161176-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=HseIkXQe; 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-161176-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161176-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 7DD771F217EC for ; Sat, 27 Apr 2024 20:38:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E89A145B36; Sat, 27 Apr 2024 20:36:35 +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="HseIkXQe" 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 C128F15991E for ; Sat, 27 Apr 2024 20:36:32 +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=1714250194; cv=none; b=q4nkvUJ7o3cECFLxn2QydKYwqcG64VnGbp95s+J3VWtWPCZQCET8URnNBF+yJfCh2D50npWyH0wuSG7IRpv60Gp2C/PlQOFSDxuti8nvHHAVpiO9TlQhE6fsoMntTHe+I5jemSiAchD/FtrlroNDUEhdRIoClpsXpCSW7k2P3nM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250194; c=relaxed/simple; bh=+MzugzJWD0ePnwNN8kUfm/oNioMUuBkwypU7J8gu1eI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=diTn0jR/4rteTfJ5VKJrirtf8suKGMRRtO3iJF5REheHCzW8LBCqZJ4sDLVonAKhyXXJZ9GQq00VDeiSUt4LR6T0qrtt5jDDegSJZ613qg1wPe7B1VCjHhSIDZudfgO0vNf+b17JekS7C2YTGUFknvakDK3Mzd5VjwOXtPQJHj0= 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=HseIkXQe; 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=gZ01Lhe4pAwdcuNCxaIYgv6RGXpiS5mlcEHdQcrIkWs=; b=HseIkX QeeKpgVS9jKY4BFhE/0UABE1zW0Qtb4VnivHX577i1yOEm/I+47oowrPMH9LHqnb MkwiKA+2NOg+KZwq2G91nlmmV01I+/7mZayTfWuToS6V/yewif7lNRllCbkQTXIj 3lSqVJV6CX4HrrakUN+dmjXfh3gU6Xy+TzgG3pr5sQF8yThqDDl17yCg0mOuET2O gqYIHau5mkauEbFYudMXLFdHwIW9Lbx9Ipej6NRnPPUTGAB4dAlJfoWgWKaioOJ1 gYBEpL6ZHriOdPz8Gfo3FviY/0Jy1BhXWB36135S/GSfv94r8K5x52vqVqCMpivg OVycBaShXiLV6cBg== Received: (qmail 1781964 invoked from network); 27 Apr 2024 22:36:20 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:20 +0200 X-UD-Smtp-Session: l3s3148p1@P+gS+RkX0s9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Pierre-Yves MORDRET , Alain Volmat , Andi Shyti , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/15] i2c: stm32f4: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:00 +0200 Message-ID: <20240427203611.3750-9-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-stm32f4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c index 859ac0cf7f6c..f8b12be6ef55 100644 --- a/drivers/i2c/busses/i2c-stm32f4.c +++ b/drivers/i2c/busses/i2c-stm32f4.c @@ -681,7 +681,7 @@ static int stm32f4_i2c_xfer_msg(struct stm32f4_i2c_dev *i2c_dev, { struct stm32f4_i2c_msg *f4_msg = &i2c_dev->msg; void __iomem *reg = i2c_dev->base + STM32F4_I2C_CR1; - unsigned long timeout; + unsigned long time_left; u32 mask; int ret; @@ -706,11 +706,11 @@ static int stm32f4_i2c_xfer_msg(struct stm32f4_i2c_dev *i2c_dev, stm32f4_i2c_set_bits(reg, STM32F4_I2C_CR1_START); } - timeout = wait_for_completion_timeout(&i2c_dev->complete, - i2c_dev->adap.timeout); + time_left = wait_for_completion_timeout(&i2c_dev->complete, + i2c_dev->adap.timeout); ret = f4_msg->result; - if (!timeout) + if (!time_left) ret = -ETIMEDOUT; return ret; -- 2.43.0