From patchwork Mon Apr 29 11:33:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646652 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 B96EC44C87 for ; Mon, 29 Apr 2024 11:33:16 +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=1714390398; cv=none; b=pKfCqYBwTH8Ih7/0+4gVWvKiPxZeGaHrPzH+eg0dUlp+HLv3T0/t27z5qdOL//f/v6DzyxGSdERHie9gwpAPh4Mugpj/s5EEMg6uh5DWyxw2EpLscj5sF6rr1Cm5Zj9IIwk3werldA0LGZp3E+BJKgXdq9mywKx74aujKmtB1VI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390398; c=relaxed/simple; bh=V06hBJ0AbH+QLN6vjA3YFpErKpkzt+h3vT6AjALWIu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TXpjxzZJ1020cpKejup6PCJobgZlGhN22U3GhglcPffjI1VV51TcQcA1TSTmjnC0XwvVa5AhHLlPFcdZ7xvZRHai95v+SaQPsTHtktOHYjh0zxQJK+dLxIuiKdCyH3kxTTvXHV6coRxN55E0DDrn5VlCnEi7AFx3NrfTtfBlNXc= 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=b3o54+FB; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="b3o54+FB" 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=ytaMDbrRHYTkVlHscVH3Jk5trLpcIFOkGRyH/ZBVpu4=; b=b3o54+ FBrZMOOENh3SFIj9rXzdWDB/PlMnG8ozVY6pIS70/2X2gDbHZh7H5/OaLvIdk10Q SGkowgG2M3LM/2Fv76mbrNXLogK9XXlIG8m0du4N6MiddcbLQ2tql2FMRoi2rdFH +67ppN7OH0BrBmUlPfOzeRhXcly+NgABG9vRkN6ZFYg92iQbIRdvZ/twGC3odSbi sXm9EIA2wLjnDAqy8d9mavlUOZiYeFXUXGAZB57swnNffTEUcTuwb2+FRDaqhrYu uwWxLEiTnz/30pRG0WfuVVaKhEjM1Qgubcwd+OB4iC1pSV26uJZAFpkg3hzwSF9m Lsl9AZOTeskRDuLg== Received: (qmail 2280987 invoked from network); 29 Apr 2024 13:33:15 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:15 +0200 X-UD-Smtp-Session: l3s3148p1@rkh5njoX3kFtKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , linux-kernel@vger.kernel.org Subject: [PATCH 1/8] iio: adc: ad_sigma_delta: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 13:33:04 +0200 Message-ID: <20240429113313.68359-2-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Nuno Sa --- drivers/iio/adc/ad_sigma_delta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index a602429cdde4..40ba6506bfc1 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -206,7 +206,7 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, unsigned int mode, unsigned int channel) { int ret; - unsigned long timeout; + unsigned long time_left; ret = ad_sigma_delta_set_channel(sigma_delta, channel); if (ret) @@ -223,8 +223,8 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, sigma_delta->irq_dis = false; enable_irq(sigma_delta->spi->irq); - timeout = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ); + if (time_left == 0) { sigma_delta->irq_dis = true; disable_irq_nosync(sigma_delta->spi->irq); ret = -EIO; From patchwork Mon Apr 29 11:33:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646653 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 E72A946B9A for ; Mon, 29 Apr 2024 11:33:17 +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=1714390399; cv=none; b=F/Shi7TzTQckQ3MSa1kDsgcvId0lxQytn7zbT7g/dIuj3Rrz5ZPrLqyI0MapXDNjLA4M0voVbBJ4MBnE0JZXtrSdalyV91CFLWQxjwXPCfOM46GPUfbcCf1l+VmNfn1xUu3IewNaDptygmo5G2TrKP4QTBCXEvYxuLlJjd1t6xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390399; c=relaxed/simple; bh=qjQ+LYbUEfrBtu3ymflLP9dmO9tQ6/Bs/eoY36v4nPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sYiDYFlPQsDQs7rBtY/QM1SG7GaqIk+frEB9ktfphea6Wt+jpkHISkmiSKMXndouY8Md3zJGH+mg8Cl6bG+cHZHVD8fEyHsJf/CZ8gI+F2BQxMW+xNUZ83MMxYQfKb8yaL8PgOFNV4wu+ZxU4dj/koXt+LZec6Z23Ei/muT+sfM= 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=aRUD4h14; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="aRUD4h14" 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=jF+95jMp/45NMjGYJKM23B9xKBucPH4GAO56Jky3844=; b=aRUD4h 14HkB1S+ge4YmGYHgC6e8z1QFZnIGEwb7VW6Wjs/dhS7SsCqi0J0cylMLueUjaEq AzQQSTtE2ukCCPvolzhDzwOet/OsyfJOcsP25SvVacjNnIPJWbyZdsFy8AWWXQjE JEN7NjXU5WZUMCKOJpmTB6Ol2U6ck+VZnD04dRml5NzTEEhWiHVaybCPCekVY0SX wmEad53AvSdMQtbMvJigWFQ9xmNYNoXjBHokUg6x7Y2SfWGm5GOz3V0j/rPqtQTq M79guIWLd/tJTTBZ5+/FF3GuhfhySodEF9CpOXSgD15S6MjKwX9XSsEl/ppis9Hs eSMz0D9XYsDRI+AQ== Received: (qmail 2281021 invoked from network); 29 Apr 2024 13:33:16 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:16 +0200 X-UD-Smtp-Session: l3s3148p1@fvOInjoXqG5tKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/8] iio: adc: exynos_adc: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 13:33:05 +0200 Message-ID: <20240429113313.68359-3-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/iio/adc/exynos_adc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 614de9644800..78fada4b7b1c 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -538,7 +538,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev, long mask) { struct exynos_adc *info = iio_priv(indio_dev); - unsigned long timeout; + unsigned long time_left; int ret; if (mask == IIO_CHAN_INFO_SCALE) { @@ -562,9 +562,9 @@ static int exynos_read_raw(struct iio_dev *indio_dev, if (info->data->start_conv) info->data->start_conv(info, chan->address); - timeout = wait_for_completion_timeout(&info->completion, - EXYNOS_ADC_TIMEOUT); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&info->completion, + EXYNOS_ADC_TIMEOUT); + if (time_left == 0) { dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n"); if (info->data->init_hw) info->data->init_hw(info); @@ -583,7 +583,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev, static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y) { struct exynos_adc *info = iio_priv(indio_dev); - unsigned long timeout; + unsigned long time_left; int ret; mutex_lock(&info->lock); @@ -597,9 +597,9 @@ static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y) /* Select the ts channel to be used and Trigger conversion */ info->data->start_conv(info, ADC_S3C2410_MUX_TS); - timeout = wait_for_completion_timeout(&info->completion, - EXYNOS_ADC_TIMEOUT); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&info->completion, + EXYNOS_ADC_TIMEOUT); + if (time_left == 0) { dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n"); if (info->data->init_hw) info->data->init_hw(info); From patchwork Mon Apr 29 11:33:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646654 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 C7DC1481A2 for ; Mon, 29 Apr 2024 11:33:18 +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=1714390400; cv=none; b=l0dyi12vfhTugRWFLxlecSNxZFznB9A9Rs4QYvUsUaDKCRoQTN1Oc3tDgi9q3te8TiXIWgIs5kOMq1brWHnmNiWgTgyr1z6aQa021bOrXH7NuIRQwfgPKED+VwFB5Sp5kPNWeZG3cO5WfyeYQkDFU0h8OMAGbdkr4GyefWPpOgw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390400; c=relaxed/simple; bh=cy2D1HP63aslov77VCicNGX0z0ZLnIZFrx66F9b/xOU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NHSwZS5YLaTnCMaJQeub/bJjq19aYQTCjCJGvJaDoQG3d6/zt+RMtM3HltXakr21sTUoVRjt3cEZSag9dS2IpXJ9aUGQgax5p5CeEmpKRt2Co2iZBP825rFDFdGpvDJatfQvOORciI15LJU7yFdvi7UsJzzIFReAGbsDoRzhz3c= 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=YWJmo1O7; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="YWJmo1O7" 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=4U8CmUX52QVRFRqLXIis6AKCy/puBxC4uuyzZRCInlU=; b=YWJmo1 O7xl4olZbGoV0XZRVVyoTBkU9TYJ/bMKtmXad+r+g4nK5Dacm/o6oqpTx+Nf2i1V //aM+hSv5+U8AhSmpeDykvycCkEYeo0KGk+ZaWYq5YR0F7LtBNJDcBJPwk/gEI7d 2LDrtJsJbVjs/QJ0fTcHbZjzbHNRuqUIJvXzWLKjCxnfhegx85w0cFrguCVpZ5MF lfKWuDaNX8RqjqfVi8cZAx6AAPQxYA6uEhn2vPAuto1a3WXjH7TzaRbtBIvSfEUa HDvRI5fILcSFo3L+nC/ibfSaiQuRSaFqH/3pK6VhOur84FKUk8oVYiHNIPeBaYyq MKbqp5QHcTDT1upA== Received: (qmail 2281070 invoked from network); 29 Apr 2024 13:33:17 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:17 +0200 X-UD-Smtp-Session: l3s3148p1@2+uYnjoX0Q9tKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , 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 3/8] iio: adc: fsl-imx25-gcq: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:06 +0200 Message-ID: <20240429113313.68359-4-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Peng Fan --- drivers/iio/adc/fsl-imx25-gcq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c index 68c813de0605..dabc5303d644 100644 --- a/drivers/iio/adc/fsl-imx25-gcq.c +++ b/drivers/iio/adc/fsl-imx25-gcq.c @@ -107,7 +107,7 @@ static int mx25_gcq_get_raw_value(struct device *dev, struct mx25_gcq_priv *priv, int *val) { - long timeout; + long time_left; u32 data; /* Setup the configuration we want to use */ @@ -120,12 +120,12 @@ static int mx25_gcq_get_raw_value(struct device *dev, regmap_update_bits(priv->regs, MX25_ADCQ_CR, MX25_ADCQ_CR_FQS, MX25_ADCQ_CR_FQS); - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &priv->completed, MX25_GCQ_TIMEOUT); - if (timeout < 0) { + if (time_left < 0) { dev_err(dev, "ADC wait for measurement failed\n"); - return timeout; - } else if (timeout == 0) { + return time_left; + } else if (time_left == 0) { dev_err(dev, "ADC timed out\n"); return -ETIMEDOUT; } From patchwork Mon Apr 29 11:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646655 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 57E834C63F for ; Mon, 29 Apr 2024 11:33:20 +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=1714390402; cv=none; b=j7YwAiOav9sWtlRibMON0P7Xzjyh9mTSikkoqV7Kbx3y/iEOjUc5Wa9e6u4b5KQKwjN18658YlzmppXYEmG15SrA6HU7P0/KCpSTu2UUwpu7PvFfUpxD4JVbj3M8FfY6r0wYo7YqNcQR/tZWchvmlr81WJclxN+5MgS0sVJMmvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390402; c=relaxed/simple; bh=IGIx1rZpf+QAHUeiwtXKxVkLhI5SUIAGbDNEWThgGrA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C5LiZ0hED+OdzXGE17YNAWXQ8Z4Xsodx7l/u1G0TZCxB0nkkKcCT1u465yRiCG4jnVIkxEnhAWkHyxeOjikkgPLAc2C5+IdxrIFM15AFK7a8OXn7Szi3OEBNAPJH2k+Wph76ABgqAJfoSV4ZitRn2HvjHxvRE4Qm9YM0nPA3WtA= 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=KtbDFO51; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="KtbDFO51" 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=kESE1b6S6hgZwP/UL/YPJJaCZtdxWblO0NQ4nm3v/zE=; b=KtbDFO 51nAKvleMvjxjL+SqADxQf1vuV85E1TX7lAu9hDHurd01LvOchlc+m1ILLLXTvMa l8tc0OTHeDc9P+q2t9TH6H24sxfbtvCj6UcsLGoWbVrw4xoYK4R/mP0+zapslkFu xUqf+2V6ZdzBcsdJk/l6XcEmvIJ9Vr1kw/a9uI6YpEgD8QtA0F0xrXvqS1oDTfIR dfwyEhXsGQiVlTRyqPO84prfqbenN5i5c3JaCtYXSIbyqHzWIaM7R+S4RQuEhXm4 D8PFS8GmiFC/lmYcSmgLwxSGmERbum8pdguVAeWacj5gJuHqfHVASEQtSP651Jbs z9wBC7rSIoThFcUQ== Received: (qmail 2281106 invoked from network); 29 Apr 2024 13:33:18 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:18 +0200 X-UD-Smtp-Session: l3s3148p1@My2onjoXDRxtKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , linux-kernel@vger.kernel.org Subject: [PATCH 4/8] iio: adc: intel_mrfld_adc: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:07 +0200 Message-ID: <20240429113313.68359-5-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/intel_mrfld_adc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/intel_mrfld_adc.c b/drivers/iio/adc/intel_mrfld_adc.c index 7263ad76124d..c7f40ae6e608 100644 --- a/drivers/iio/adc/intel_mrfld_adc.c +++ b/drivers/iio/adc/intel_mrfld_adc.c @@ -75,7 +75,7 @@ static int mrfld_adc_single_conv(struct iio_dev *indio_dev, struct mrfld_adc *adc = iio_priv(indio_dev); struct regmap *regmap = adc->regmap; unsigned int req; - long timeout; + long time_left; __be16 value; int ret; @@ -95,13 +95,13 @@ static int mrfld_adc_single_conv(struct iio_dev *indio_dev, if (ret) goto done; - timeout = wait_for_completion_interruptible_timeout(&adc->completion, - BCOVE_ADC_TIMEOUT); - if (timeout < 0) { - ret = timeout; + time_left = wait_for_completion_interruptible_timeout(&adc->completion, + BCOVE_ADC_TIMEOUT); + if (time_left < 0) { + ret = time_left; goto done; } - if (timeout == 0) { + if (time_left == 0) { ret = -ETIMEDOUT; goto done; } From patchwork Mon Apr 29 11:33:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646656 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 5A5F24DA12 for ; Mon, 29 Apr 2024 11:33:21 +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=1714390403; cv=none; b=HNOcjvAqZ6im+2xrpxUt772w6vOyLlVOocq+kKbcNOqzcACbqNRSLZKJ5Q78SnypWX7KArCX6IXd4XqZQ0yuK3EEPUh9/0XCfZx47ZZowG1xdChiyzB3ycOuTsUGzVztC8Jj1ZZHucxmU6xv7a9YkNAdVyl5IkzkaQKS2bMvTHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390403; c=relaxed/simple; bh=YI13TytLVIliMo2K45hbcn0KvPRg7d0WFvP/hHQC7GE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oIfNoDOd0rCXMehzx8xFajJtI4fsNd1rofQFp6AQODSIIF3HsJaHT5GRsp92957rD8LnSukX62wHmZhg3z3U2ijbgeVAo4q1dY0uFXNyXEdhcoQYaAj7ZXAPutmDWXi/irIKwjc7XhS7vU+ZuNMTIOnzYWWoLsV5MxQLqQo1uD8= 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 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" 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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; From patchwork Mon Apr 29 11:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646657 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 ABABB50A7A 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=h7Kk8kcdXwD5Sq2xeCxzeCrDjoRnU7m8J+FlbFOsKuR/YXhXZfZKW+QzvVt3zNMG5qroHkTiGqr920CueANmbww3U07SUnHBJfbf5WXcJhwQYvmOfqpKbISMebouyfXduXfr723CJvxxU1bZIGvwPisxOcKfck/BrRtArSW1q84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390404; c=relaxed/simple; bh=TXBJ8kRFQEVxHoBSaGXMRzgHJL9lguRH+McDdALDhbs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YI4hpCnL82j89mW2NG9Pu1/PYkyrUfJ84iper0iM2tqgZIBGw3uqJef2KYEcWZV6JO+i6hQrN4H6dVFG6AdoRznxxWW+mUUXGGCprCKqJVW+6C7r/F7d1kJpKtUUHmf6QoLq6suEh9a1Pq1iaV/+TAkL6WSWI2cgjemVH1xXOWk= 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 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" 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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; From patchwork Mon Apr 29 11:33:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646658 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 A0FBC524C3 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=B79BNiKnaMl/RVXofDc4T/UMoNYItQK1vp1yPkn72o7nkhTS4cI2C81si6xxOQjs+EOINPGkkaCcTtDlFuRZiy9Fvl245WtNERWfyTwnfQuLhNg0J18nH35MqJ315Su6G8eBfwG45KWkixkeQPLXKYi70IQIQ0wIqFk3g+iJbiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390405; c=relaxed/simple; bh=IdhLliF3I34ob0fmKFJFFe1MNaGnbf324kblqz/L3Xc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m4QcXpdgdLihVEoEb04iU/hrOQt63vEGplLK4f6NBeUoAUwMwsVpFaRkFFfCCY9i2TB/A0MdRqRYW4j06Qhr2nJdNBOGZDeIuwiDPmWca+H9VjvjfZ/TIWQ2b+cdtDuXoC5R78UsoeTwkqR6b0WOIC8mMj2E2+F75b7SXgO3Dd4= 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=MAcOPI0n; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="MAcOPI0n" 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=7WxOY8Hqqwt7I9BFZQWHS3JVVzhT3Xl4XwRHu/Qd27g=; b=MAcOPI 0nVZbpF/9LmEWS+jfhT6KB5iGcddFfw3W2h1I/GkPINuWNAOe91u9LkMvbRVfKu0 htmVWfgJ936SU9etiRTSq5DEkdzudVwN/DipUwQjudjxwYvfNECJp3/RNrrzmLGv 4frOCNdzrmTeuFDRFNrsu3YTYcS6qXzW0+MF63SJvuHkJeOkTtJVD7ewChf7b6AN ThRKejPl1aM+sgRM/aCc/I0qi/9a/ODYWLRdIewBkQmafOcO9knhbhlpd6WD8kvc LXi2oawrYGEatSc2ODKDmHw1t2LRShRVipIwoL7dHsOvbzyL8nQN0CLuwI8kQE7I G+pqdtVCfWGFSEJQ== Received: (qmail 2281230 invoked from network); 29 Apr 2024 13:33:21 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:21 +0200 X-UD-Smtp-Session: l3s3148p1@L1fWnjoXpy5tKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , linux-kernel@vger.kernel.org Subject: [PATCH 7/8] iio: adc: twl6030-gpadc: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:10 +0200 Message-ID: <20240429113313.68359-8-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/twl6030-gpadc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index 78bf55438b2c..6a3db2bce460 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -519,7 +519,7 @@ static int twl6030_gpadc_read_raw(struct iio_dev *indio_dev, { struct twl6030_gpadc_data *gpadc = iio_priv(indio_dev); int ret; - long timeout; + long time_left; mutex_lock(&gpadc->lock); @@ -529,12 +529,12 @@ static int twl6030_gpadc_read_raw(struct iio_dev *indio_dev, goto err; } /* wait for conversion to complete */ - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &gpadc->irq_complete, msecs_to_jiffies(5000)); - if (timeout == 0) { + if (time_left == 0) { ret = -ETIMEDOUT; goto err; - } else if (timeout < 0) { + } else if (time_left < 0) { ret = -EINTR; goto err; } From patchwork Mon Apr 29 11:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13646659 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 A35EC52F85 for ; Mon, 29 Apr 2024 11:33:24 +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=1714390406; cv=none; b=WRob/1eR14yuWjjpFyDs/uHF66HvNLHgbyRfizxSQmOcWQ9Dxkkn8Rbt/FZnGE4/NYXhzPysjbs/ZdkldWf7e21snw5wrFVMSKCmw9jrCiOgmYnr3TaHO0dvCp6Et2PmdkDqB/AI8iAgnGURQykXsiWOX2g/vHHuuj7DbrTR10g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390406; c=relaxed/simple; bh=2uX3wkKhmFCqFWQCxlFoe6vDeE4dnIiY2m9s/rKq9oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=htcXIvGhfXKsIWwdbVLMRktg1BufMQoglihBAcov+r4aNUacMxXhCeLuXklaAhRohY72sm9WapXiZKvk0DZO3kOozWGu2GLFBbgxZs5ro5GezK9VNcHINzxpMC3xoa52pEUEDr+2jPrhyguKP4Y+B/tIn4xWvZgSxUx5tyWT3Qk= 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=ihc0ZqSZ; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="ihc0ZqSZ" 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=9jrudQes/oY0ss0zHQRh6mDwrbJoU9KkQ26G3FR9LtI=; b=ihc0Zq SZ+nOKe3RRSC5eQoHXP8j8Hk/Po3Xqz96sq8eRhN1khue2jt5X4jQN58u6jU8SFJ 2JVq/t8DKkv9Srcoj5KncOteHfb8dj4CS9ZOlqRupOPuMya5hb6u+3+uyt07Lpui TJ5sboFZvNBWE739ZvfnbptMghuQkUAj6LqAo7stf/vp+qEbd1aDCGE8aPw2BaWd 2OVKIH/oXEg72lsXa9npyf6wNzpKwghDhdAhEPGSEC1UvvSQiufL9+fP2caxGCVj j2FoS0LLbD0nPO8Ei5nze1Ic7PPsdS6bvjh35p3Ooc7ssLLK9y1cwjUkpYZUQ5sv CXoCgO/OVKFQEF8Q== Received: (qmail 2281276 invoked from network); 29 Apr 2024 13:33:22 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:22 +0200 X-UD-Smtp-Session: l3s3148p1@tgrlnjoXfEVtKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , linux-kernel@vger.kernel.org Subject: [PATCH 8/8] iio: pressure: zpa2326: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:11 +0200 Message-ID: <20240429113313.68359-9-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/pressure/zpa2326.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c index 421e059d1f19..dcc87a9015e8 100644 --- a/drivers/iio/pressure/zpa2326.c +++ b/drivers/iio/pressure/zpa2326.c @@ -861,13 +861,13 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, struct zpa2326_private *private) { unsigned int val; - long timeout; + long time_left; zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &private->data_ready, ZPA2326_CONVERSION_JIFFIES); - if (timeout > 0) + if (time_left > 0) /* * Interrupt handler completed before timeout: return operation * status. @@ -877,10 +877,10 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, /* Clear all interrupts just to be sure. */ regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); - if (!timeout) { + if (!time_left) { /* Timed out. */ zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", - timeout); + time_left); return -ETIME; }