Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1295342lqa; Mon, 29 Apr 2024 04:41:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLFmeEZcS4udFuLDlY1hN6uXwpNPeNVrGZh296jXz6AhHWhZmThx+8FxWg3uJYxT6dXO3TfEu5jQlLpbJinUn6BVFiScBWyY8JURt/dw== X-Google-Smtp-Source: AGHT+IEquubyHxmLyHehE1iV8KVn0KhDv8SY23BCpqlMWd5TfurXJZ7zkXekzEjqV18g3qYB0yLl X-Received: by 2002:a50:bb45:0:b0:572:32e4:73b4 with SMTP id y63-20020a50bb45000000b0057232e473b4mr9624098ede.11.1714390908672; Mon, 29 Apr 2024 04:41:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390908; cv=pass; d=google.com; s=arc-20160816; b=GV3An3DjmL+HytOdkxlm4wm3Tjkez7YGxI47KZRf8dv/KOtbNQ1JxzIEkrPeiIjSF7 rm7jTpFywu5GfJ0gA1GmGz4QNRDZ8Auyejhr/6LFARzrwKRgoQ9AGG3ANm2PN1RerEhT YYOqDxot8SrkFJSoAPWe5oUaBnK/npPeXd9vyj0CMR5VsVM7WWMvkA7+cJ6Inm+a2FJs wU1duV6/7iNANkRj4V+kjuD0R0+Gb+J87Qwdcck32igKR0Oz68d7oqtOGXW5IAsLDTD3 mVCK4/mj8NogHDJUycmQjeaiCct/TviWIJb+khUyyV+caoc1dYhiykavG8PY4usrdusF xF3w== 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=pTKgsnnnR48vpHuUZSyQHs6dIzn04ZSLBe3TZUJ9DSQ=; fh=YXBM+4OMENuF/d0ZDnIAKrjr7066eWVR0tCsjGYsftg=; b=aSzxC4jL2XGb2frJ3VQdfHFPnRybgzvBqgU6Jsi98+krIdP1Bhjz20UzvTEXWcmU4K JOzcThWXu6pzRJg9LHtkaM+fU5HDyprNu4EoiNy71e6QzoTkbGZDGMztxHOAXPTgQTnH 3vA3SVQXfdNAQPgaoQzNunIKUf5QuJhdI1PDul+PovuxMJDdPZ45F56ckOZb4d07OV/p DyDSAE4+LP4S2Igf5B/P/AO/xSS0EU4ZFnXGrUrt/qs8Ql6/5dfjgzw1WPO8PMpxJwF5 d4xzI//MzkhsxHzmbLk2N+JyYpqkdRC7Bqb1jkhlqzLi/K9rvfVqxWQapOFaDFVtkciq I1mA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=F+YIfNBe; 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-162156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162156-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 d7-20020a50ea87000000b0056e6cd79578si13468532edo.578.2024.04.29.04.41.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:41:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162156-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=F+YIfNBe; 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-162156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162156-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 A07361F24B7B for ; Mon, 29 Apr 2024 11:34:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 151DE53378; Mon, 29 Apr 2024 11:33: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="F+YIfNBe" 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 920C445018 for ; Mon, 29 Apr 2024 11:33: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=1714390404; cv=none; b=LU+EohbBJpUAKqt7pzojMmDiORZnA4BE8ihEqxcdSW35F19kVLjKbjHJokSgGjKGaPVRRLIdIYbrOnMFKhP7JaqdsxlNITpJZecRzRXUs2EUi8Aza/+hI5E3NARgByJJJZ3EjNYN56g71ejOtoD2NgPJOvTdN2igxf3soswjHm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390404; c=relaxed/simple; bh=YI13TytLVIliMo2K45hbcn0KvPRg7d0WFvP/hHQC7GE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zf2hTsWR4jAF0tBh1jxezBNm9FVXezkM1ee1TwCmyD41oXhrDy+qQ/H0+Pcuopg1LaMCajkYL7h8Wcyw5VQvW6sxeHVTfktmvqorYMAHrxOcIdU55Uqg0zdHDbOepA6HTlz8opGfZ7Iob9zI4BjW24btePG1JA7G6jVXX2kyDU0= 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=F+YIfNBe; 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=pTKgsnnnR48vpHuUZSyQHs6dIzn04ZSLBe3TZUJ9DSQ=; b=F+YIfN Bef5N4igD5o5TLEi7in+MbPhNF4xKt/4L64LuUaivoLegMLsYx21WYKMJpVQXS8N xztANF5xlZYEGF6INXjo6SVzlo3gMugtaLATPejPkpSmVSoiv4EkXSkLlIm+7fLF 1LdKYizTB17AxiZCPlg/HoQeHNFjHum05AyhfdRyoVgZ8qet5sSEAjRj/6lnstwD xXAUXhdY1mFrBhm1ver1Vge5hEi+k/7p75uzpVlFNAccMS+G5/Z8qZ72p6NYhXvZ 5YGUpS5aJgGkF1Df5NWC0slsoWWrNPZPRPKR5YfhOHMU0GAy0JPkLOHEmB9cBkg9 P8+GchupFvv2TaCg== Received: (qmail 2281145 invoked from network); 29 Apr 2024 13:33:19 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:19 +0200 X-UD-Smtp-Session: l3s3148p1@Z+u2njoXhihtKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/8] iio: adc: stm32-adc: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:08 +0200 Message-ID: <20240429113313.68359-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429113313.68359-1-wsa+renesas@sang-engineering.com> References: <20240429113313.68359-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_interruptible_timeout() causing patterns like: timeout = wait_for_completion_interruptible_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/iio/adc/stm32-adc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index b5d3c9cea5c4..7cad0ce1d9b9 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -1408,7 +1408,7 @@ static int stm32_adc_single_conv(struct iio_dev *indio_dev, struct stm32_adc *adc = iio_priv(indio_dev); struct device *dev = indio_dev->dev.parent; const struct stm32_adc_regspec *regs = adc->cfg->regs; - long timeout; + long time_left; u32 val; int ret; @@ -1440,12 +1440,12 @@ static int stm32_adc_single_conv(struct iio_dev *indio_dev, adc->cfg->start_conv(indio_dev, false); - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &adc->completion, STM32_ADC_TIMEOUT); - if (timeout == 0) { + if (time_left == 0) { ret = -ETIMEDOUT; - } else if (timeout < 0) { - ret = timeout; + } else if (time_left < 0) { + ret = time_left; } else { *res = adc->buffer[0]; ret = IIO_VAL_INT; -- 2.43.0