Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1292174lqa; Mon, 29 Apr 2024 04:34:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhnaGRoSNlhq9jOEsU0Y5RKNr9NNxWrhW+yuuiLsjuVcW6iDCIS1Pj6Z1Yo9Lb5aK2q5CSyQN80cmbDk/D/2y3JefZed9L5ZzOXKc8BA== X-Google-Smtp-Source: AGHT+IGpTRJ7XIogSl96WCa4lWjVLPamyyAD/jL8m3UxvI7pBCbWfPC9Gxtynqp2nfXq79SPuGH6 X-Received: by 2002:a05:620a:d88:b0:790:98f8:955e with SMTP id q8-20020a05620a0d8800b0079098f8955emr11678281qkl.30.1714390489018; Mon, 29 Apr 2024 04:34:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390489; cv=pass; d=google.com; s=arc-20160816; b=BZce2/8aIr3BNsmvsBN5ApxggYtJFVc7V6VmDZLlebUu23RDhzhQDa/ST1Nz4PYy9n WtfC++zTDgwdDrptlALqZg2meyXGiMBasGv6M8U5boQOB4mkrJFitUXJZoHpowS/vQyt sTaDsz7144dbE5E0c8Uj25pGIAfi9ZxaKAU9RHpcrwIRGGW238fSPdmTPZDeEFma4n0a IVVg7s5ue+A0DdKzY6W2T/cDG3Jk6NAB4xcHtUZHreBNffz76xIlMIpCNNPoPmYd/hGC 32A0shl+2rE4OpB8UgUW11OfJ+xKSLgj0zjRRmPFS7KIfzmQsnQ6s2QOo9dohHrhvZ2h T+sQ== 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=bO1DtnMljUne5cLDZB1KSz1EuNPq+xZvMkPybT2DdrE=; fh=YXBM+4OMENuF/d0ZDnIAKrjr7066eWVR0tCsjGYsftg=; b=qHPJujT0T46R2NhSdQwxF/YslRiEoTi0GkFiVMoleqx9BP0RJc1BXJ66Hym8ZajLcv o0o9bScqjZrQYfqSFa+lypKtIfFRm8WdZ/wiuJMzM6DHvZLnMFFkhzfxlo4UwsfwFO7l 1YWAnhWjb94z5oebMgtX0cdYdy7FC37FNL3GqtZE0UjzULiA2eYZKgBXhFpxJ3HkRR87 BwvAEx2CjQ38ZoAYbU63PrkPrMiK8dGLu60my8i3bWF5BQTN6DShkoPIByOhy4IskxRe si09KX8FwzKqow4jNLm0+l++iGn2Up1xL0OAhLkYl7XMHXJNRP/h9/ibmXH2aRS+FUuh aigA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=ZYN+XvwW; 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-162157-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162157-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id oq5-20020a05620a610500b0078d4be48d1bsi22290046qkn.353.2024.04.29.04.34.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:34:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162157-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=ZYN+XvwW; 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-162157-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162157-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BDD871C21046 for ; Mon, 29 Apr 2024 11:34:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CA48537F2; Mon, 29 Apr 2024 11:33:26 +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="ZYN+XvwW" 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 EF85C524D3 for ; Mon, 29 Apr 2024 11:33:23 +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=1714390405; cv=none; b=sH72uSPlJwEc7rvMTG4K2x6ZRK6+F8EhDaKYmISrF2BMUVhsNnps9YMb7WPrjHQ300dWpSLGUKmC7xRwjWMS+V9EANrhWIXdIc8FwpV2G3uh+FKFE1BdEiyV+VH6CnsFv5blOSZHlFiAu8YAS3MAjMsbw6oB7Kyai1d/HfTzY8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390405; c=relaxed/simple; bh=TXBJ8kRFQEVxHoBSaGXMRzgHJL9lguRH+McDdALDhbs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HTrIzrrAgfF4eZnFACT49SjVWmTv6LRwUOfLDxJACrjkcE01LWoQWl+psb15ZyhwmSqu6TVuDSTwmp+wy4JkS8cP7owwOchrY51B5rc2z9T+mDPqvV51wH/DvAMZ1GNopJJBj4IE0Y24OvUUaMyu1W7JNgM7aJQ3HTZ8+1fzij8= 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=ZYN+XvwW; 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=bO1DtnMljUne5cLDZB1KSz1EuNPq+xZvMkPybT2DdrE=; b=ZYN+Xv wWeFNBOF4Y8yRRdjLfpuYYiOie4X6UwOAzSuoFW71Fm6/CrsOObdfXp3ZzJ6SeNL PFO348ThErNZ/rU+bjEP2bEMd78KMiWNLiwJE4S5jFIe+M0tGYpQr43qG2B83WIo 98aPenf+xGgbq413oFMgJ/3dQsU9DDWdKDaTcq4L6xRR4z6kjV7NBJa8R0dnNgyo CeKLaJXT3Hae7NfDW+lO1wHhYrEaDQmPXTlj9jo7e97NqNUXlpYHXe7eYSNpIfFl IBjFj4e4NBgZuraYXNpnOUvZiHJFookG0aIjHvU0hdHF/yNBIhxQ0q29KhzT7rCy 9skzpGb4Q0ZH7hHw== Received: (qmail 2281181 invoked from network); 29 Apr 2024 13:33:20 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:20 +0200 X-UD-Smtp-Session: l3s3148p1@JvPGnjoXHnRtKPB4 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 6/8] iio: adc: stm32-dfsdm-adc: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:09 +0200 Message-ID: <20240429113313.68359-7-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-dfsdm-adc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c index ca08ae3108b2..9a47d2c87f05 100644 --- a/drivers/iio/adc/stm32-dfsdm-adc.c +++ b/drivers/iio/adc/stm32-dfsdm-adc.c @@ -1116,7 +1116,7 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int *res) { struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); - long timeout; + long time_left; int ret; reinit_completion(&adc->completion); @@ -1141,17 +1141,17 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev, goto stop_dfsdm; } - timeout = wait_for_completion_interruptible_timeout(&adc->completion, - DFSDM_TIMEOUT); + time_left = wait_for_completion_interruptible_timeout(&adc->completion, + DFSDM_TIMEOUT); /* Mask IRQ for regular conversion achievement*/ regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id), DFSDM_CR2_REOCIE_MASK, DFSDM_CR2_REOCIE(0)); - if (timeout == 0) + if (time_left == 0) ret = -ETIMEDOUT; - else if (timeout < 0) - ret = timeout; + else if (time_left < 0) + ret = time_left; else ret = IIO_VAL_INT; -- 2.43.0